Last active
January 15, 2016 07:56
-
-
Save justo/4a92655056f43d32ae72 to your computer and use it in GitHub Desktop.
Atom mac path inheritance
This file contains 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
# Problem: Atom won't inherit the $PATH variable set in your default OS X shell (Terminal). | |
# Solution: Launch an interactive shell and return $PATH from that. The interactive | |
# shell will run through all your various .files (.zshrc, .zshenv, etc.) before | |
# returning. Works well if your path is changed by NVM or RVM. Some existing solutions | |
# don't work if your shells output a MOTD or any other text before executing | |
# 'echo $PATH', as that will also be returned. Since your path _should_ be the last | |
# line output we can grab all text after the last newline character and use that as Atom's path. | |
# | |
# Some related issues: | |
# https://github.com/atom/atom/issues/6956 | |
# https://github.com/atom-community/linter/issues/726 | |
# Add this to your init.coffee script: | |
childProcess = require('child_process') | |
shellOutput = childProcess.execFileSync(process.env.SHELL, ['-i', '-c', 'echo $PATH']).toString().trim().split('\n') | |
process.env.PATH = shellOutput[shellOutput.length - 1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment