imathis / octopress

Octopress is an obsessively designed framework for Jekyll blogging. It’s easy to configure and easy to deploy. Sweet huh?

Home Page:http://github.com/imathis/octopress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When I upgraded the Mac system, I can't Preview

liuchungui opened this issue · comments

Work well in Mac10.10, but when I upgraded to Mac10.11, I input command 'rake preview', got following error.

$rake preview
Starting to watch source with Jekyll and Compass. Starting Rack on port 4000
rake aborted!
Errno::ENOENT: No such file or directory - compass
/Users/user/git/octopress/Rakefile:85:in spawn
/Users/user/git/octopress/Rakefile:85:in block in <top (required)>
Tasks: TOP => preview
(See full trace by running task with --trace)
userdeMacBook-Pro:octopress user$ Configuration file: /Users/user/git/octopress/_config.yml
Source: source
Destination: public
Generating...
done.
Auto-regeneration: enabled for 'source'

I am getting exactly the same error on El Capitan. rake generate works fine (seemingly) but rake watch fails with the same error.

Here is my trace:

$ rake preview --trace
** Invoke preview (first_time)
** Execute preview
Starting to watch source with Jekyll and Compass. Starting Rack on port 4000
rake aborted!
Errno::ENOENT: No such file or directory - jekyll
/Users/espressive/repos/schalk-neethling/Rakefile:84:in `spawn'
/Users/espressive/repos/schalk-neethling/Rakefile:84:in `block in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/usr/bin/rake:37:in `<main>'
Tasks: TOP => preview

Alrighty @liuchungui so here is the tl;dr of what I did to get this to work on El Capitan:

Install rbenv [https://github.com/sstephenson/rbenv]
Install ruby 2.2.2 rbenv install 2.2.2
Now, inside the root of your octopress blog do

rbenv local 2.2.2
gem install bundler
rbenv rehash
bundle install

rake preview etc. should now all work. I assume it has something to do with the Ruby version that comes with El Capitan although not 100% certain. HTH!

Thank you, it work for me.

I edit Gemfile, and change source.

source 'https://ruby.taobao.org/'

group :development do
  gem 'rake', '~> 10.0'
  gem 'jekyll', '~> 2.0'
  gem 'octopress-hooks', '~> 2.2'
  gem 'octopress-date-format', '~> 2.0'
  gem 'jekyll-sitemap'
  gem 'rdiscount', '~> 2.0'
  gem 'RedCloth', '~> 4.2.9'
  gem 'haml', '~> 4.0'
  gem 'compass', '~> 1.0.1'
  gem 'sass-globbing', '~> 1.0.0'
  gem 'rb-fsevent', '~> 0.9'
  gem 'stringex', '~> 1.4.0'
end

gem 'sinatra', '~> 1.4.2'

This is what I did to get this to work on El Capitan:

1.Clear git cache
rm -rf /usr/local/.git

2.Uninstall Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

3.Install RVM
curl -L https://get.rvm.io | bash -s stable --ruby

4.Install Ruby 2.2.3:

rvm install ruby-2.2.3

rvm use 2.2.3

rvm rubygems latest

Run ruby --version to be sure you're using Ruby 2.2.3.

4.Next, install dependencies.

cd octopress

sudo gem install bundler

bundle install

rake preview etc. now all work. It's work for me in EI Capitan.

Great post. Every time osx upgrade there always will be something

commented

Thank you @JonyFang . I've tried lots of methods to fix it,finally it works on my EI Capitan. However,ruby 2.2.2 is also OK.

Thanks for this @schalkneethling, solved my issue