gpt4 book ai didi

ruby - 在 RubyMine 中设置默认的 Ruby 变量

转载 作者:太空宇宙 更新时间:2023-11-03 16:22:20 27 4
gpt4 key购买 nike

我使用 mac 和 ruby​​mine 7.1.2 我想设置默认环境变量?是否可以根据运行配置设置它们,以便每个测试、Rails 生成器、Rails 控制台都可以访问它们。

是否有类似.env 文件之类的东西,所以可以只设置一次?

最佳答案

Jetbrains 实际上有 a page帮助您做到这一点:

Mac OS X applies .bash_profile and .profile only for Terminal.app environment and Apple's technical documentation suggests using ~/.MacOSX/environment.plist for other applications. So, by default PATH value will differ for RubyMine and the console.

MacOS 10.6 or later

We recommend to manage your environment variables using free Enviroment Variables preference pane instead of environment.plist manual editing.

MacOS < 10.6

Unfortunately, the "environment.plist" approach doesn't always work on MacOS < 10.6, e.g if you start RubyMine from Spotlight the environment is not applied.

Thus real solution is to set your environment variables in /etc/launchd.conf (thanks to David Goudreau for this tip). For detailed description please read Mac OS X Global Environment Variables article.

So you should:

  1. Open /etc/launchd.conf file (e.g. $sudo nano /etc/launchd.conf)

  2. Then set correct PATH env variable

    setenv PATH /Users/romeo/.gem/ruby/1.8/bin:/opt/local/bin:/opt/local/sbin:/opt/local/libexec/git-core:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  3. Set other env variables for RubyMine if necessary

  4. Save changes

  5. Reboot

P.S: If you always launch RubyMine using Dock or QuickSilver and do not use Spotlight you can install Enviroment Variables preference pane and use it instead of the manual environment.plist editing.

NB: Please don't miss "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" in the end of PATH value, because PATH=...:$PATH doesn't work here.

关于ruby - 在 RubyMine 中设置默认的 Ruby 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31706725/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com