Sync-settings and paths


Packages with external dependencies might require some path to be configured. For example:

  rubyExecutablePath: "/Users/kaischaper/.rbenv/shims/ruby"

I’m using the sync-settings package. Problem is, I have different usernames on my machines. Therefore the paths have to be different. Unfortunately I can’t use neither ~/.rbenv/shims/ruby nor $HOME/.rbenv/shims/ruby. Any ideas how to solve this?


PS: I think this is not an issue of sync-settings but of Atom itself. Shell expansion would be nice to have if not essential in configs.


Atom currently has no way of distinguishing a path from any other string value in the config. The best way to solve this would probably be to add a path data type to the Config class that would perform these kinds of expansions.


You could try to monkey-patch the atom.config.get function to replace environment variables in string values. It might break some packages, tough. This example replaces $HOME in any config string value to the value of the HOME environment variable: (put in

oldConfigGet = atom.config.get
atom.config.get = (args...) ->
  result = oldConfigGet.apply(atom.config, args...)
  if typeof result is 'string'
    return result.replace /\$HOME/, process.env.HOME
    return result

# You may need to reload the package after patching atom.config.get
for package in ['package1', 'package2']
  atom.packages.deactivatePackage package
  atom.packages.activatePackage package


Thank you both for your replies! I gave Olmo’s suggestion a try. I works so far. However I have to iterate over result because it’s always an object:

oldConfigGet = atom.config.get
atom.config.get = (args...) ->
  result = oldConfigGet.apply(atom.config, args)
  if typeof result is 'string'
    result.replace(/\$HOME/, process.env.HOME)
  else if typeof result is 'object'
    for k, v of result
      if typeof v is 'string'
        result[k] = v.replace(/\$HOME/, process.env.HOME)

for p in ['linter-ruby', 'linter-eslint']
  atom.packages.deactivatePackage p
  atom.packages.activatePackage p