<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Ruby on ZRJ | 学习笔记</title>
        <link>https://blog.zrj.me/tags/ruby/</link>
        <description>Recent content in Ruby on ZRJ | 学习笔记</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>zh-CN</language>
        <lastBuildDate>Sun, 17 Jan 2016 03:28:58 +0800</lastBuildDate><atom:link href="https://blog.zrj.me/tags/ruby/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>ruby gem 安装 compass</title>
        <link>https://blog.zrj.me/posts/2016-01-17-ruby-gem-%E5%AE%89%E8%A3%85-compass/</link>
        <pubDate>Sun, 17 Jan 2016 03:28:58 +0800</pubDate>
        
        <guid>https://blog.zrj.me/posts/2016-01-17-ruby-gem-%E5%AE%89%E8%A3%85-compass/</guid>
        <description>&lt;p&gt;这年代，前端越来越复杂，又是 gem 又是 compass，又是 less 又是 sass，还有 grew 和 grunt，一堆堆的名字，上来就能把新手给吓个半死，这个暂且按住不说。&lt;/p&gt;
&lt;p&gt;这年代，凡是个语言就有要个包管理器，不过这个倒是应该，任何语言都面临着库管理的问题，但是能不能不要假设网络一定是好的啊，要知道这个世上还有天朝这种孤岛啊，那怎么办，墙外开花墙内香，maven 有 oschina 的镜像，debain 有网易的镜像，ruby 有淘宝的镜像，今天就说说这个 ruby gem 如何在天朝安装 compass。&lt;/p&gt;
&lt;p&gt;首先看这里，&lt;a class=&#34;link&#34; href=&#34;http://blog.csdn.net/bluefish1990/article/details/21093349&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://blog.csdn.net/bluefish1990/article/details/21093349&lt;/a&gt;，说道了，可以添加淘宝的源&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;如果国外服务器不给力，也可以把GEM的源换成国内的，比如淘宝：&lt;/p&gt;
&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;http://ruby.taobao.org/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://ruby.taobao.org/&lt;/a&gt; 你需要在CMD下设置：&lt;/p&gt;
&lt;p&gt;gem sources -a &lt;a class=&#34;link&#34; href=&#34;http://ruby.taobao.org/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://ruby.taobao.org/&lt;/a&gt; 想了解更多请访问 &lt;a class=&#34;link&#34; href=&#34;http://ruby.taobao.org/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://ruby.taobao.org/&lt;/a&gt;！&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;不过需要注意的是，现在淘宝源已经 https 了，但是加了源还不能用，为啥，优先级呗，看这里，&lt;a class=&#34;link&#34; href=&#34;http://stackoverflow.com/questions/1672482/how-to-remove-a-remote-source-from-gem-remote-sources&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://stackoverflow.com/questions/1672482/how-to-remove-a-remote-source-from-gem-remote-sources&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ gem sources -r &lt;a class=&#34;link&#34; href=&#34;http://gemcutter.org&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://gemcutter.org&lt;/a&gt; &lt;a class=&#34;link&#34; href=&#34;http://gemcutter.org&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://gemcutter.org&lt;/a&gt; removed from sources&lt;/p&gt;
&lt;p&gt;$ gem sources *** CURRENT SOURCES ***&lt;/p&gt;
&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;http://gems.rubyforge.org/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://gems.rubyforge.org/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;把原来的源给删了，就可以了，唉，逼着把正室给休了&lt;/p&gt;
&lt;p&gt;-&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&lt;/p&gt;
&lt;p&gt;2016-02-26 00:43:05 update&lt;/p&gt;
&lt;p&gt;在 mac os x yosemite 上，出现一个问题，明明安装好了 compass，但是在 eclipse 中使用 maven 进行自动构建的时候，一直报错，说 compass 找不到，而我在命令行下又是可以使用 compass 命令的，反复纠结，无解，Google 怎么搜都没有头绪，后来偶然发现在命令行下使用 which 命令可以定位 compass，但是使用 whereis 命令却定位不到 compass，这是为什么呢，这里，&lt;a class=&#34;link&#34; href=&#34;http://superuser.com/questions/430002/whereis-and-which-return-different-paths-in-mac-os-x&#34;  title=&#34;http://superuser.com/questions/430002/whereis-and-which-return-different-paths-in-mac-os-x&#34;
     target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://superuser.com/questions/430002/whereis-and-which-return-different-paths-in-mac-os-x&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In the manpage of whereis, it clearly says (emphasis mine):&lt;/p&gt;
&lt;p&gt;The whereis utility checks the standard binary directories for the specified programs, printing out the paths of any it finds.&lt;/p&gt;
&lt;p&gt;The path searched is the string returned by the sysctl(8) utility for the ``user.cs_path&amp;rsquo;&amp;rsquo; string Contrary to that, which is the tool commonly used to check where a binary is for your user&amp;rsquo;s path.&lt;/p&gt;
&lt;p&gt;The which utility takes a list of command names and searches the path for each executable file that would be run had these commands actually been invoked. That explains your difference, since /opt/local/bin is not a system-wide &amp;ldquo;standard&amp;rdquo; path—after all, MacPorts is a completely optional installation—and sysctl only has /usr/bin:/bin:/usr/sbin:/sbin in its user.cs_path per default.&lt;/p&gt;
&lt;p&gt;In general, stick to which or which -a to find a binary rather than using whereis.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;于是就想，会不会跟这个有关系，然后就尝试把 compass 从 /usr/local/bin 建立一个软链接到 /usr/bin 中，但是发现即使用 sudo 也无法往 /usr/bin 写入文件，又找到这里，&lt;a class=&#34;link&#34; href=&#34;http://www.jianshu.com/p/22b89f19afd6&#34;  title=&#34;http://www.jianshu.com/p/22b89f19afd6&#34;
     target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;http://www.jianshu.com/p/22b89f19afd6&lt;/a&gt;，说道&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;更新了 Mac OS X 11后发现，MacVim 不再能够通过Terminal用命令打开了。&lt;/p&gt;
&lt;p&gt;mvim hello.txt 于是尝试将 mvim 重新复制到/usr/bin/中去&lt;/p&gt;
&lt;p&gt;sudo cp -f mvim /usr/bin/ 然而出现了权限问题：&lt;/p&gt;
&lt;p&gt;cp: /usr/bin/mvim: Operation not permitted 搜索之后发现，是El Capitan 加入了Rootless机制，不再能够随心所欲的读写很多路径下了。设置 root 权限也不行。&lt;/p&gt;
&lt;p&gt;Rootless机制将成为对抗恶意程序的最后防线 于是尝试关闭 Rootless。重启按住 Command+R，进入恢复模式，打开Terminal。&lt;/p&gt;
&lt;p&gt;csrutil disable 重启即可。如果要恢复默认，那么&lt;/p&gt;
&lt;p&gt;csrutil enable 附录: csrutil命令参数格式：&lt;/p&gt;
&lt;p&gt;csrutil enable [&amp;ndash;without kext | fs | debug | dtrace | nvram][&amp;ndash;no-internal]&lt;/p&gt;
&lt;p&gt;禁用：csrutil disable&lt;/p&gt;
&lt;p&gt;（等同于csrutil enable &amp;ndash;without kext &amp;ndash;without fs &amp;ndash;without debug &amp;ndash;without dtrace &amp;ndash;without nvram） 其中各个开关，意义如下：&lt;/p&gt;
&lt;p&gt;B0: [kext] 允许加载不受信任的kext（与已被废除的kext-dev-mode=1等效） B1: [fs] 解锁文件系统限制 B2: [debug] 允许task_for_pid()调用 B3: [n/a] 允许内核调试 （官方的csrutil工具无法设置此位） B4: [internal] Apple内部保留位（csrutil默认会设置此位，实际不会起作用。设置与否均可） B5: [dtrace] 解锁dtrace限制 B6: [nvram] 解锁NVRAM限制 B7: [n/a] 允许设备配置（新增，具体作用暂时未确定）&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;于是进入恢复模式，把这个保护关掉，重新建立软链接，终于跑通，苍天大地。&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
