Building Gnuplot from Sublime2 OSX

1.1k views Asked by At

I am struggling to execute gnuplot scripts from Sublime2.

Gnuplot is installed and I can execute it from Terminal (OSX). My build configuration in Sublime 2 looks like this:

{
    "cmd": ["gnuplot"]
}

when Building it get the following result:

[Errno 2] No such file or directory
[cmd:  [u'gnuplot']]
[dir:  /Users/macuser/Documents/Gnuplot]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

How to I set up the build instructions in sublime so the script will be send to gnuplot with the current path as a working directory?

Thanks

2

There are 2 answers

0
noslin005 On BEST ANSWER

I'm using Sublime Text 3 on OS X 10.9, and I solve the problem with the following procedure:

  1. Open terminal and navigate to the Installed Packages on Sublime Text:

    $ cd ~/Library/Application Support/Sublime Text 3/Installed Packages
    
  2. Copy the file Gnuplot.sublime-package and paste in Desktop.

    $ cp Gnuplot.sublime-package ~/Desktop
    
  3. Rename the file to Gnuplot.zip and extract the content to a folder, ex. Gnuplot.

    $ cd ~/Desktop
    $ mv Gnuplot.sublime-package Gnuplot.zip
    $ unzip Gnuplot.zip -d Gnuplot
    
  4. Navigate to the folder, Gnuplot, open the file gnuplot.sublime-build with any text editor, like vim or, even, sublime text. Don't close the terminal window.

    $ subl gnuplot.sublime-build
    
  5. Onterminal type:

    $ which gnuplot
    
  6. Copy the path and with the file gnuplot.sublime-build opened previously in step 4, append the following line path like this:

    {
        "cmd": ["gnuplot", "$file"],
        "path": "$PATH:/usr/texbin:/usr/local/bin:/opt/local/bin:",
        "working_dir": "${project_path:${folder}}",
        "selector": "source.gnuplot"
    }
    
  7. Save the file, and open terminal again. Type the following commands:

    $ cd ~/Desktop/Gnuplot/
    $ zip Gnuplot.sublime-package *
    $ mv Gnuplot.sublime-package  ~/Library/Application Support/Sublime Text 3/Installed Packages\
    
  8. Restart sublime text 3, and it will work fine. Sorry with my bad english. LOL

4
AGS On

In your case, a minimum build system should look something like this:

{
    "cmd": ["/full/path/to/gnuplot"],
    "working_dir": "${project_path:${folder}}"
}

You can also set "working_dir" to any specific directory. Check this page out for further info on constructing a build file:

Build system reference