2

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

N_2
  • 113
  • 5

2 Answers2

1

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

noslin005
  • 96
  • 2
  • 8
0

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

AGS
  • 14,288
  • 5
  • 52
  • 67
  • I don t know where the the location of gnuplot is on my system. I tried to figure it out by invoking it with the "whereis" command, but I don get any answer. Gnuplot can be invoked with Terminal from any location on my system. Do I need to specify it with sublime? Also: last comma in your answer might be wrong. – N_2 Oct 18 '13 at 11:22
  • Did you actually install `gnuplot` on your machine? What OS are you using, if linux/OSX try `which gnuplot`. – AGS Oct 18 '13 at 11:26
  • Thanks. **WHICH** worked. "/usr/local/bin/gnuplot" OSX 10.8.5 – N_2 Oct 18 '13 at 11:34
  • Cool. I removed the comma in question, too. – AGS Oct 18 '13 at 11:34