Home Download Buy Blog Forum Support

OSX Path problem - can't use Make

OSX Path problem - can't use Make

Postby joshnapkins on Wed Feb 23, 2011 5:13 pm

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?
joshnapkins
 
Posts: 2
Joined: Wed Feb 23, 2011 5:07 pm

Re: OSX Path problem - can't use Make

Postby theblacklion on Wed Feb 23, 2011 6:55 pm

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:
https://bitbucket.org/theblacklion/subl ... ca/exec.py

Hope it helps,
Oktay.
theblacklion
 
Posts: 67
Joined: Sat Feb 05, 2011 10:07 pm
Location: Hannover, Germany

Re: OSX Path problem - can't use Make

Postby joshnapkins on Wed Feb 23, 2011 8:52 pm

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"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/Xcode4/usr/bin</string>
</dict>
</plist>
joshnapkins
 
Posts: 2
Joined: Wed Feb 23, 2011 5:07 pm

Re: OSX Path problem - can't use Make

Postby Marciano on Fri Mar 04, 2011 5:26 pm

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 :-)
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: OSX Path problem - can't use Make

Postby gingerbeardman on Wed Apr 20, 2011 10:37 am

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.
gingerbeardman
 
Posts: 10
Joined: Fri Apr 15, 2011 11:33 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], swhansen and 39 guests