Created
March 27, 2015 20:40
-
-
Save bhstahl/d6187a168a04b9f01b90 to your computer and use it in GitHub Desktop.
Python script to manage nvm and ST3 pathing for OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sublime package NVM node path configuration | |
# Save this file in: | |
# ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/node_env.py | |
import os | |
import getpass | |
user = getpass.getuser() | |
nvm_default_file_path = '/Users/%(user)s/.nvm/alias/default' % {'user': user} | |
with open(nvm_default_file_path, 'r') as content_file: | |
content = content_file.read() | |
version = content.strip() | |
path = "/Users/%(user)s/.nvm/%(version)s/bin:/Users/cranemes/.nvm/%(version)s/lib:/Users/%(user)s/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" % {'version':version, 'user':user} | |
os.environ["PATH"] = path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment