If I print my $PATH in a terminal (zsh) I get:
λ echo $PATH
/Users/jviotti/.nvm/v0.11.13/bin:/Users/jviotti/bin/Sencha/Cmd/4.0.2.67:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/opt/bin:/Users/jviotti/bin:/home/jviotti/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin
However if I print the environment variables from Sublime Text 2 console I only get:
>>> print(os.environ['PATH'])
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jviotti/bin
Sublime Text 2 detects that I'm using Zsh, however most of my paths are missing.
How can I fix this?
When you launch Sublime via the command line with the subl command, it picks up your current PATH from your shell. However, files launched from the GUI have a separate PATH, and this is what needs to be changed. Please check out my answer over at Unix.SE for detailed instructions on how to set the PATH for OS X programs launched via the Dock or Finder. This has only been tested on Mountain Lion (there is a different method for Lion), and while it should work on Mavericks I can't guarantee it. It does require having admin privileges.
Briefly, you need to edit /etc/launchd.conf (or create it if it doesn't exist) to include all the entries you want, then restart your computer for the changes to take effect. Keep in mind that this will affect all GUI programs, not just Sublime, so if you start getting unexplained behavior or errors, this may be the reason.
Good luck!
Related
I just installed Sublime-jshint (and the requisite node.js + jshint) but get this error when I try to invoke JSHint from within ST2:
[Errno 2] No such file or directory
[cmd: [u'jshint', u'PATH-TO-THE-JS-FILE-I-AM-LINTING', u'--reporter', u'/home/cmg/.config/sublime-text-2/Packages/JSHint/reporter.js']]
[dir: DIR-MY-JS-FILE-IS-IN]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/cmg/bin]
[Finished]
The final item in the given path is in the home dir of my user (cmg), so it's been customized somehow... but I don't recall how, so I don't know how to add the dir I need (~/node_modules/.bin).
I've added it to $PATH in my shell (via both .bashrc and .bash_profile) but ST2 doesn't pick it up.
(I'm on Ubuntu 14.04. All the usable stuff I've found via Google on this subject has been either OS X specific or related to ST's build system).
Basically, the exec command, which the jshint package uses internally, allows you to set/extend the PATH of the spawned subprocess. (docs)
The package actually uses this path argument on OSX, but has it hardcoded (I am partly guilty of that as I rewrote the command because it was just horrible before). It should allow for a setting to specify the path to your jshint executable, so I suggest you create an issue for that.
I don't know why ST dosn't pick up your PATH from somewhere else since I have very little experience with that.
Open /etc/profile in Sublime (using sudo) and add the following line at the very bottom:
export PATH=/home/cmg/node_modules/.bin:$PATH
and save the file. Restart completely, and your PATH should be updated.
I am using Octave for some Machine Learning work and I have noticed in my package library in Sublime that there is SublimeREPL: Octave as an option.
However when I select it, I get the following error message:
FileNotFoundError(2, "No such file or directory: octave")
Is there a way to use sublime to code with Octave?
Many thanks
First, you need to find out where your octave executable lives, and note the full path to it. On Linux or OS X, open your favorite terminal emulator and type which octave, and if it's in your $PATH variable it will print the full path to it (for example, /opt/local/bin/octave or something like that). If it's not in your path, or if you're on Windows, you'll have to search around a bit until you find octave or octave.exe, if you're on Windows.
Once you have the path, open Sublime and select Preferences -> Browse Packages..., which will open your Packages folder (surprisingly). Navigate to Packages/SublimeREPL/config/Octave and open the Main.sublime-menu file in Sublime - don't worry, it's just plain JSON. Go down to line 18 (or thereabouts) - it should say "cmd": ["octave", "-i"],. Change "octave" to "/full/path/to/octave", obviously replacing /full/path/to/ with the actual full path you noted earlier.
Save the file, and you should be all set. Tools -> SublimeREPL -> Octave should now open up an interactive session, just like running octave -i on the command line would do. You can use all of the usual SublimeREPL shortcuts to send code to the running REPL, or just use if for testing functions, code snippets, etc.
Have fun!
I am using Sublime Text 3 on OS X
Octave programs are running perfectly. So you can try the below mentioned steps
Open Sublime
Goto Tools --> Build System --> New Build System...
Paste this code
{
"cmd": ["/usr/local/octave/3.8.0/bin/octave-3.8.0", "$file"],
"selector": "source.m"
}
Save it as Octave.sublime-build
Now use Octave as your build system
Use ⌘ + B to run your code.
Enjoy!
I am using Sublime Text 2 for Mac. I have installed the Package Control for Sublime Text 2, following the instructions from https://sublime.wbond.net/installation#st2 without any trouble. However, when I open up Ctrl+Shif+P to search for available packages, it does not show any.
See the image screenshot here
Do you have any solutions for it? I try restart Sublime but it doesn't solve the problem.
Take a look in your user Preferences.sublime-settings and remove the Package Control from the "ignored_packages" list if it is there.
If you use a Linux based system, you may have to check permissions of /home/user/.config/sublime-text-3. Check if the directory is owned by your user. If not, change the owner user for that directory.
Click the Preferences > Browse Packages and check whether Package control file is there or not.
You can manually put package control file there by downloading it from here and get rid of issues.
I had the same problem. I had to restart my computer to properly reset Sublime Text 2. It seems from your comment that you also got the Package Control list to show up after restarting your computer.
Your screenshot image is currently broken, but make sure you have the zipfile "Package Control.sublime-package" in the Installed Packages directory.
Open the console and run this command:
curl http://sublime.wbond.net/Package%20Control.sublime-package -o ~/Library/Application\ Support/Sublime\ Text\ 2/Installed\ Packages/Package\ Control.sublime-package
Then restart sublime.
See this issue: https://github.com/wbond/sublime_package_control/issues/652
I'm trying to run Make from Sublime Text 2, but getting an error:
make: arm-none-eabi-gcc: No such file or directory
This only happens from Sublime Text, when I run from Terminal, everything works fine.
I've setup .bash_profile with
export PATH="~/arm-cs-tools/bin:$PATH"
...but still no can do? How can i get ST to resolve the $PATH environment variable?
From unofficial Sublime Documentation:
On some operating systems, the value for PATH will vary from a
terminal window to a graphical application. Thus, even if the command
you are using in your build system works in the command line, it may
not work from Sublime Text. This is due to user profiles in shells.
To solve this issue, make sure you set the desired PATH so that graphical applications such as Sublime Text can find it. See the links below for more information.
Alternatively, you can use the path element in .sublime-build files to override the PATH > used to locate the executable specified in
cmd. This new value for PATH will only be in effect for as long as
your build system is running. After that, the old PATH will be
restored.
Note that while this documentation is for v1 and is deprecated, the official documentation references this passage directly here
So you should be able to define a custom path in the .sublime-build file. using the path option
Setting and using Sublime Text 2 as the git editor does not wait correctly within a tmux session.
$ tmux
$ export EDITOR="subl -w"
$ git rebase HEAD^ -i (close file, terminal hangs)
If the EDITOR is set without the wait, then the file is opened in ST2 as before, but then of course the rebase then gets applied immediately within the shell.
I do not use Sublime Text, but I have read a question on Super User that seems to be about this same problem.
The solution involves using the “wrapper” program that I made to allow pasteboard access inside tmux. The “fix” is not specific to pasteboard access, so the program also turns out to alleviate problems in several other areas that are not related to cut/copy/paste operations. The method that Sublime Text uses to implement the “wait” feature of subl -w invocations seems to be one of these “other areas”.
You can get the wrapper through MacPorts from their tmux-pasteboard port, or through Homebrew from their reattach-to-user-namespace formula, or compile it yourself from my tmux-MacOSX-pasteboard repository at GitHub.
Once you have it installed, you may want to configure (per the README) a default-command in your .tmux.conf so that shells spawned inside tmux will automatically be “reattached”. Alternatively, you could use the wrapper in your EDITOR value:
EDITOR='reattach-to-user-namespace subl -w'