TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Don't Use the Mac System Ruby

6 点作者 DanielKehoe超过 4 年前

2 条评论

DanielKehoe超过 4 年前
I always heard this advice but didn’t know why. So I looked into it. Basically, the system Ruby is fine for running sysadmin scripts (as long as you don’t add gems or try to update it). But don’t use it for development because:<p>- the default location for gems is the system Ruby directory &#x2F;Library&#x2F;Ruby&#x2F;Gems&#x2F;2.6.0 so you will need to be superuser to install gems (and you really shouldn’t alter this folder)<p>- you could use sudo to install gems but that’s a security risk (gem installation can run malicious code)<p>- using Bundler is a best practice to manage gem versions and dependencies<p>- it’s best to start projects with the newest version of Ruby and the system Ruby is 2.6.3<p>- the pre-installed Ruby is deprecated by Apple and may disappear in future macOS releases<p>Did I miss anything?
frenkel超过 4 年前
Part of the argument can be easily circumvented. Have a look at gem install --user and bundle config set --global path. These allow you to install and manage all your gems in your homedir without the need for sudo. I do this all the time in Linux and OpenBSD to use the system ruby.
评论 #26093284 未加载