1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Sublimetext2でCompassビルドできないので、rvmからrbenvへ乗換えた。

Last updated at Posted at 2015-05-05

これを書いたのは2014/12/9ですが、今のところ(2015/5/4)この設定でも動いています。

ことのはじまり

事の始まりは、sublimetext2でcompassが使えなかったこと。
ビルドしようとすると"compass not found." となってしまっていた。
先生に相談したところ、どうもrvmを使ってrubyのバージョンを管理していると不都合が多いらしい。
どうしても解決できないので、rubyの管理をrvmからrbenvに替えることにした。

参考URL

1. rvmからrbenvへ乗り換える

1.1. rvmのアンインストール

ターミナルで以下を実行。

$ rvm seppuku

で、消す。

$ ls -la

で、残り滓を探す。

$ rm -rf .rvm

で、完膚なきまで消す。

1.2. $PATHを確認する

$ echo $PATH

で、チェック。
一応保存しておく。
パスが残っていたものがあったので、

$ export -n $PATH

で、消す。
その後、

$ export PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/X11/bin' 

で必要なものだけ書きだす。

1.3. bash_profileに書いてあるrvm用の設定を消す。

vimを使うなら

$ vi ~/.bash_profile 

sublimetextを使うなら

$ subl ~/.bash_profile

で内容をチェック。
rvm用の設定部分を削除。
これでrvmとは後腐れなくさよならできたはずだ。

1.4. rbenvとかのインストール(homebrewインスト済)

homebrewはインスト済として、

$ brew doctor
$ brew install rbenv ruby-build rbenv-gem-rehash

1.5. bash_profileの設定

$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

これで、rbenvが使えるようになる。

2. rbenvでrubyをインストール、設定など

2.1. rubyをインストール

$ rbenv install --list

で、インストールできるrubyをチェック。

$ rbenv install 2.2.0

で、インストール。

2.2. rbenvで使うrubyを設定

$ rbenv global 2.2.0

で、使うrubyを2.2.0に設定する。

$ rbenv rehash

で、パスを通して使えるようにする。

$ ruby -v

で確認。

$ which ruby
/Users/watashitawashi/.rbenv/shims/ruby

でも確認。

3. Compassの導入

3.1. gemで必要なgemsをインストール

  $ gem install sass compass

sass, compassを導入。

$ gem list

で確認。
終わり。

4. sublimetext2の設定

早速設定。

まずは、sublimetext2で、command + shift + P。
list package→compassと行き、Compass.sublime-buildを開く

内容を以下のようにする。

{
"osx":{"path": "/usr/local/bin:/Users/nawano/.rbenv/shims:$PATH"},
"cmd": "sh '${packages}/Compass/build.sh' '${file_path}' '${project_path:${folder}}'",
"working_dir": "$packages/Compass",
"selector": "source.sass, source.scss",
"shell": "true",
"windows":{"cmd": "build.cmd \"${file_path}\" \"${project_path:${folder}}\""}
}

ビルドできた。動いた。
よかったよかった。
おわり。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?