Sublime Forum

OSX Path problem - can't use Make

#1

Hi, I’m new to Sublime Text and Python, so forgive me if this is a stupid question, but I can’t get the make command to work at all.

I believe I’ve narrowed it down to the fact that Sublime Text doesn’t have the path set correctly, but I’m not sure how to fix that. Here’s an example of what I run…

import os
os.environ’PATH’].split(os.pathsep)
‘/usr/bin’, ‘/bin’, ‘/usr/sbin’, ‘/sbin’]

On my system make is located in /Xcode4/usr/bin. Make runs fine from the console and I have /Xcode/usr/bin in my /etc/paths file. Any clues? Is there a simple way to set the path variable inside Sublime?

0 Likes

Creating a build process and using PATH
#2

Hi there,

as discussed in other threads before it’s “normal” 'cause Sublime normally gets started thru the Dock which doesn’t load your shell profile. In order to fix this I’ve written a cheap extension of the exec.py supplied with Sublime, which makes it possible to use an arbitrary script as a preloader. It’s not beautiful but it works for me in all ways. I’m also using it to load a proper virtualenv for my Python development, but that’s optional.
So if you like, grab my exec.py and put it into your Packages/User/ folder. A small howto can be found in the file header.

Grab the code here:
bitbucket.org/theblacklion/subl … ca/exec.py

Hope it helps,
Oktay.

0 Likes

#3

Thanks, I figured it out. For anyone that has the same problem, you have to edit the path variable in ~/.MacOSX/environment.plist which is where apps look for environment variables. Since I didn’t have the .MacOSX folder or that file I had to do the following in Terminal:

mkdir .MacOSX
cd .MacOSX
nano environment.plist

Then I typed the following in to set the PATH variable. Obviously, this will differ from person to person, but here’s what mine looks like now…

<?xml version="1.0" encoding="UTF-8"?> PATH /usr/bin:/bin:/usr/sbin:/sbin:/Xcode4/usr/bin
0 Likes

#4

Two comments (I was just burned by this J):

  1. the environment.plist file is only read AT LOGIN. Therefore, after creating the file, you have to log out and log back in (no need to restart).

  2. on MacOS X 10.5 (Leopard) and earlier versions, this file is read only if the app (i.e. ST2 in this case) is started from the Finder (or, I suppose, the Dock); it is NOT read if it is started from Spotlight. On MacOS X 10.6 (Snow Leopard), this is not a problem: things work even if you run the app from Spotlight.

Just thought I’d share :smile:

0 Likes

#5

Thanks for this. It has been sending me crazy!

Any news of a workaround as it’s not ideal that users have to edit this file.

0 Likes