jekyll error / sh: command not found: jekyll - jekyll

I installed jekyll and when i run this command
jekyll serve --watch
I get
sh: command not found: jekyll
This is what's inside my zshrc file
PATH=$PATH:$HOME/.rvm/bin
and ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]
I run OSX 10.9
I found some solutions that suggest to change the PATH but not working.
Not experienced with ruby.
Thanks
Edit:
gem environment
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.5.0]
- INSTALLATION DIRECTORY: /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/Cellar/ruby/2.0.0-p247/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0
- /Users/user1/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
Changed the path to
PATH=$PATH:$HOME/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0
but still not working

So after #tamouse suggested to run brew doctor I got theses warnings and I managed to fix them and I think this was the main issue after upgrading to OSX 10.9.
After that I installed Ruby using
rvm install ruby-2.0.0-p247
and this fixed the issue.
Thanks every one

Try this PATH setting:
PATH=$PATH:/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0
The directory containing jekyll is not under $HOME.

Related

Require 'mysql' fails in Textmate ruby script but works in irb in Terminal

When I run my ruby script simply with
require 'mysql'
in text mate it fails with the following error:
LoadError: cannot load such file — mysql
method require in kernel_require.rb at line 54
method require in kernel_require.rb at line 54
method <main> in Test.rb at line 1
However, if I run it through irb in terminal, require 'mysql' returns a true and I am able to create my connection and query my database.
Please tell me why my textmate script cannot load the mysql gem but irb in terminal can.
Thank you
UPDATE
When I run gem env in terminal I get this:
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-darwin14.0]
- INSTALLATION DIRECTORY: /Users/(useraccount)/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /Users/(useraccount)/.rbenv/versions/2.1.5/bin/ruby
- EXECUTABLE DIRECTORY: /Users/(useraccount)/.rbenv/versions/2.1.5/bin
- SPEC CACHE DIRECTORY: /Users/(useraccount)/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/(useraccount)/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0
- /Users/(useraccount)/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/(useraccount)/.rbenv/versions/2.1.5/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /Users/(useraccount)/.rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/(useraccount)/.rvm/bin
And when I run gem env in text mate as a shell script I get this:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.0.0 (2014-05-08 patchlevel 481) [universal.x86_64-darwin14]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /Users/(useraccount)/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-14
- GEM PATHS:
- /Library/Ruby/Gems/2.0.0
- /Users/(useraccount)/.gem/ruby/2.0.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/(useraccount)/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/bin
Looks like Textmate is using the wrong ruby. Try the instructions from this SO post: Configure Textmate 2 for rbenv

Can't Connect to MySql From Rails Application in Windows

I am trying to create a Rails application in windows with MySQL as the Database. I have created a rails app and it runs just as fine. But when I try to connect to the mySQL database I am getting weird errors, which I was unable to solve after hours of Googling and hunting around. Maybe I am performing a silly mistake, new to Rails and Ruby.
Here is how I proceeded in creating the app with MYSQL
In command prompt
rails new sample_app -d mysql
[success]
Opened a new command prompt window and
C:\sites\cd sample_app> rails -s
Now I get this error
Could not find gem mysq12 (>=0) in any of the gem sources listed in your Gemfile
Run bundle install to install missing gems
Note: I didn't get the error when I created my first rails app without using Mysql.
Next, I ran this command
gem install mysql2
And got this
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.8.7/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for rb_hash_dup()... no
checking for rb_intern3()... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Next I ran this one -
bundle install
Closed all command prompt windows, opened a new one, moved to my app directory and typed
rails -s
Error:
could not find gem mysq12 (>=0) in any of the gem sources listed in your Gemfile
Run bundle install to install missing gems
Here are some information which I think will be useful
- Rails 3.0.9
- Ruby 1.8.7
- rake (10.1.0, 0.8.7)
- mysql (2.9.1 x86-mingw32)
- MySql 5.6 installed and running (I have created a DB and tables)
- OS: Windows 7 64bit
Here is how my database.yaml file looks like:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: sample_app_development
pool: 5
username: root
password: buiskol
host: localhost
Here is how the gemfile of the app looks like
source 'http://rubygems.org'
gem 'rails', '3.0.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2', '~> 2.9.1'
I think the problem is that my mysql2 gem is not properly installed. I am not sure where I am doing the mistake. Any help will be much appreciated.
Why are you using gem 'mysql2', '~> 2.9.1' instead of gem "mysql2", "~> 0.3.13"? According to this, there isn't any 2.9.1 version, maybe you meant 0.2.9 ? Otherwise, you're installing the wrong version of that gem, or the wrong gem with the right version.
You should use:
gem "mysql", "~> 2.9.1"
or
gem "mysql2", "~> 0.3.13"
in your gem file. Since there's no version 2.9.1 for mysql2, correct the typo and try again

heroku rake db:migrate ERROR "gem install activerecord-mysql-adapter"

im using Rails 3.2.6 trying to run
heroku run rake db:migrate
i get the adaptar ERROR
rake aborted!
Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.)
in my database.yml i have development, production, and test set to:
adapter: mysql2
this is my gem env
➜ my_app git:(master) gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-11-10 patchlevel 327) [x86_64-darwin11.4.2]
- INSTALLATION DIRECTORY: /Users/jcollyer/.rvm/gems/ruby-1.9.3-p327
- RUBY EXECUTABLE: /Users/jcollyer/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
- EXECUTABLE DIRECTORY: /Users/jcollyer/.rvm/gems/ruby-1.9.3-p327/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /Users/jcollyer/.rvm/gems/ruby-1.9.3-p327
- /Users/jcollyer/.rvm/gems/ruby-1.9.3-p327#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
i have tried a few things i found googling, no luck. any help appreciated! thanks!
Remember that Heroku uses the config property DATABASE_URL instead of your database.yml file for connecting to your db. Make sure it is set. If you are using the ClearDB add-on, then the value you want should be in the CLEARDB_DATABASE_URL.
heroku config
Copy the value that ClearDB will have set for you in the CLEARDB_DATABASE_URL config variable. Set the DATABASE_URL to the same value
heroku config:set DATABASE_URL=mysql2://bb06ca765fb123:71b6dabc#us-cdbr-east-04.cleardb.com/heroku_703eded6aebc123?reconnect=true
Here's the catch. Most people are using the mysql2 gem, so you typically need to set the DATABASE_URL to mysql2... instead of mysql.
There's no need to abandon mysql and migrate to postgre.
On Heroku, your best option for a database is postgresql, hands down. There are a handful of reasons that boil down to: that's how Heroku was designed to work.
If you're simply using the rails orm you can use the mysql2psql gem in your development environment and change your config files to use postgresql in production.
If you're really married to mysql for whatever reason, you'll need to install a heroku addon to get your app up and running. There are a couple options but here's one: https://addons.heroku.com/cleardb
But really, your best bet is to migrate your app to postgresql, it's worth it.
More info here:
https://devcenter.heroku.com/articles/heroku-mysql

Why doesn't mysql show up under gem list after installing successfully?

Here's the deal:
$ gem -v
1.3.7
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-darwin10.4.0]
- INSTALLATION DIRECTORY: /Users/harriett/.rvm/gems/ruby-1.9.2-p0#rails3tutorial
- RUBY EXECUTABLE: /Users/harriett/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/harriett/.rvm/gems/ruby-1.9.2-p0#rails3tutorial/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
- /Users/harriett/.rvm/gems/ruby-1.9.2-p0#rails3tutorial
- /Users/harriett/.rvm/gems/ruby-1.9.2-p0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
$ gem list mysql
* LOCAL GEMS *
Why doesn't it show up?
Naturally, when I require "mysql" in a ruby program I get:
`require': no such file to load -- mysql (LoadError)
Your Ruby install is being managed by RVM. See "DO NOT use sudo..." on the RVM site.
Try installing it without sudo and it should show up in your gemlist.

gem install mysql ... ERROR

To install MySQL gem:
$ export ARCHFLAGS="-arch i386 -arch x86_64"
$ gem install mysql -- --with-mysql-config=/usr/local/bin/mysql_config
returns an error:
ERROR: While executing gem ... (NoMethodError)
undefined method `spec' for nil:NilClass
How can I fix it?
Info:
$ brew list
git
mysql
readline
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/horace/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://rubygems.org/
$ which mysql
/usr/local/bin/mysql
$ gem list
*** LOCAL GEMS ***
brewbygems (0.3.1)
sqlite3-ruby (1.3.2)
Thanks!
EDIT:
Output from dtruss: http://clomputing.com/temp/dtruss-gem-install-mysql.txt
For Ubuntu (Maverick) it is needed to install
sudo apt-get install libmysqlclient-dev
and after that run
sudo gem install mysql
for other diestribution, first
sudo apt-get install libmysqlclient-dev
and check where mysql_config is http://packages.ubuntu.com/
and run
sudo gem install mysql --with-mysql-config=path/to/mysql_config
Maybe try running it with strace and see what the problem is?
strace gem install mysql --with-mysql-config=/usr/local/bin/mysql_config
or if you're on Mac OS X
dtruss gem install mysql --with-mysql-config=/usr/local/bin/mysql_config