Why am I getting a command not found for Padrino? - ruby

EDIT: This seems to work on my CentOS machine but not my Ubuntu box.
$ which gem
/usr/bin/gem
$ which padrino
/usr/bin/padrino
$ which padrino-gen
/usr/bin/padrino-gen
I started playing with Sinatra but when I started thinking about some admin/authentication support I was lead to Padrino.
Problem is as follows.
I ran:
sudo gem install padrino
but then when I ran the create command, I got a command not found issue:
$ padrino g project demo-app
padrino: command not found
This seems to work in my directory where I created my heroku app because there's a gemfile there so I can run bundle exec before the padrino command. But shouldn't I be able to create a padrino project without a gemfile??

I faced the same issue and the following helped me out:
Simply just restarted my terminal.
If it is not feasible in your case, try to source your .bashrc/.bash_profile.
Environment managers like rbenv, rvm unfortunately require this step.

pretty strange, try with:
sudo gem install padrino-gen
If doesn't help try to directly
padrino-gen project demo-app

this worked for me in Ubuntu 11.04
# Setup Ubuntu LTS 10.4
sudo apt-get install ruby
sudo apt-get install ruby-dev
sudo apt-get install sqlite
sudo apt-get install libsqlite3-dev
sudo apt-get install irb
sudo apt-get install rdoc
sudo apt-get install libopenssl-ruby
sudo apt-get install g++
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
>tar zxvf rubygems-1.3.6.tgz
cd rubygems-1.3.6
sudo ruby setup.rb
sudo gem1.8 install rake rspec padrino --no-ri --no-rdoc
padrino g project foo -d activerecord -b
padrino g admin
padrino rake ar:setup
ref: https://gist.github.com/1016133

I had this same problem, and fixed it by copying this command from the .bash_profile file which was created when I installed RVM, and adding it to the end of my .bashrc:
source "$HOME/.rvm/scripts/rvm"

Related

permission error when installing gem from terminal

I have been trying to install zsteg with the gem install command, but i get this error, even as a super-user:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
I have tried sudo gem install zsteg, sudo -s then gem install zsteg and just gem install zsteg, but none work. What should I do?
edit: I am using macOSX Mojave and I have ruby
I just reinstalled rake and zsteg and it worked for me.
1. make sure you have ruby-dev
2. update --system
3. sudo gem install rake
4. sudo gem install zsteg
good luck!
So I worked it out. I changed the install directory to /usr/local/bin using this:
gem install zsteg -n /usr/local/bin

Problems Installing Metasploit Framework on Ubuntu

I have encountered 3 problems while following this guide to installing Metasploit Framework on Ubuntu and Debian:
1) After installing proper version of ruby, there is a command given for installing Ruby libraries: sudo gem install bundler. When I typed that in and hit enter, it says "command not found". After some researching on the internet, I decided to remove sudo and try again. So I've entered gem install bundler and it worked fine. Will this cause any problems?
2) After installing Metasploit Framework, there is a command given to install the required gems and versions:
cd metasploit-framework
bundle install
But when I tried that, I got this error:
rbenv: version '2.1.6' is not installed
I really don't know what to do next (But I moved on).
3) Probably due to the previous problems, in the end when I executed msfconsole command, it said
could not find rake-10.4.2 in any of the sources.
run bundle install to install the missing gems
But the bundle install doesn't help either, because when I run that it says
Could not locate Gemfile or .bundle/directory
Any help would be appreciated.
EDIT: When I asked the person himself who had written the guide, regarding this, he told me to select the version of ruby I had just installed with either rebind or RVM before installing bundler, and then to run the bundle install. Could you please list the commands to do so? I am really new to Linux!
step 1 :
sudo apt-get update
sudo apt-get upgrade
step 2 :
Install dependent packages
sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev curl zlib1g-dev
step 3 :
Install Ruby
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
source ~/.bashrc
rvm install 2.1.6
rvm use 2.1.6 --default
ruby -v
step 4 :
Install and configure postgresql
sudo apt-get install postgresql
sudo -s
su postgres
createuser msf -P -S -R -D
createdb -O msf msf
exit
Step 5 :
Install Metasploit Framework
cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework
cd metasploit-framework
sudo bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'
Still if you are facing any issue, you can download the iso or vm image from kali wesbite
I have this problem in kali after install metasploit-framework, and i can't run msfconsole. I solved the problem using the following method:
At change your directory to /usr/share/metasploit-framework:
cd /usr/share/metasploit-framework
and after that, install bundler with gem:
gem install bundler
then:
bundle install
at the end you need to update:
gem update --system
and it will work!
This command fixes it:
apt-get install ruby2.1-dev &&\
apt-get install libsqlite3-dev &&\
bundle install
What it does: install ruby development items

Installing Compass & Susy on Ubuntu 12.04

I'm trying to install Compass and Susy on my Ubuntu 12.04.
What I have tried are the following steps on the console:
sudo apt-get install rubygems1.8
sudo gem install rubygems-update # Instead of sudo gem update --system
sudo update_rubygems
sudo gem install compass # Installing Compass & Sass
sudo gem install susy
So the gems are installed and will be listed when I do the following command:
gem list
But now, when I try to create a new compass project with
compass create project
I get the following error:
/usr/local/bin/compass: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
My current ruby version is 1.8.7. So I installed ruby 1.9.1 and get it working.
The console still says the current ruby version is 1.8.7
My question: Do I have to run with both ruby versions to get that working? Is there another way under ubuntu? It's working, I know, but it's a bit confusing.
Using Ubuntu's package manager for multiple ruby versions is a bit of a lost cause.
Most people use rvm, which allows you to install and switch between multiple rubies very easily.
Other popular options are rbenv and chruby. It's just a question of personal preference, but I'd say that rvm has the slight edge for beginners.
Also, I wouldn't recommend installing ruby 1.9.1 - it's best to use 1.9.3 as there are some compatibility issues with other 1.9.x versions.
You can then install compass and sass via ruby gems (rather than aptitude):
$ gem install compass
$ gem install sass
This simple command works on ubuntu 14.10
sudo apt-get install ruby-compass
RVM is awesome and really easy to install. I managed to install rvm, compass, and sass with these commands in my terminal:
Firstly:
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled --ruby=1.9.3
This will instal rvm, it will put a command in ~/.bash_profile to load rvm automatically, except this isn't what Ubuntu uses so put this line into your ~/.bashrc file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Then simply run:
gem install compass
gem install susy #(or sass)
Install build-essentials and ruby-dev packages to install compass without errors.
sudo apt-get install build-essential
sudo apt-get install ruby
sudo apt-get install ruby-dev
sudo gem install compass
Masterchief's answer is close, but didn't work for me. This web page provided a clear and reliably working way to install rvm on my ubuntu server instance: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Failed to build gem native extension when install RedCloth-4.2.9 install Linux

I want to install Octopress in my computer.
I try to do it like
Octopress document.
When I run
bundle install
I got error message
An error occured while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
So, I run
sudo gem install RedCloth -v '4.2.9'
then, I got a error message again:
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
I hadn't learn any knowledge about ruby.
My ubuntu 12.04 solution is install the ruby1.9.1-full version, that can resolve this issue.
sudo apt-get install ruby1.9.1-full
you can execute command:
sudo update-alternatives --config ruby
to select the altiernative ruby which you have installed.
and then, execute below commands to finish the octopress deploy:
git clone https://github.com/erizhang/octopress.git octopress
cd octopress/
sudo gem install bundler
sudo gem install RedCloth -v '4.2.9'
bundle install
rake install
below commands you can find from octopress deploy guideline page:
rake setup_github_pages
sudo rake setup_github_pages
sudo rake generate
sudo rake deploy
Hope it's helpful for you, thanks
I was installing Octopress too and got the same problem as yours. After checking the mkmf.log file I figured out that gcc-4.2 had not been found. I Even installed xcode with the command line tools. It worked when I made a symlink like this:
$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
$ bundle install
I fixed this issue by running
sudo apt-get install ruby-dev
as described in this blog post.
You've probably upgraded to Mountain Lion and have not rebuilt your ruby-1.9.2 install yet with the new development packages.
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
If you don't have the Mountain Lion dev packages installed correctly, use the ThoughtBot instructions.
For Ubuntu 14.04 simply do this:
sudo apt-get install ruby1.9.3
Should work for 13.10 and 13.04 too. (Not tested)
it apears you are not using rvm for managing your ruby installation. I think best would be to try rvm, here's a very good guide, you can stop without installing rails: ruby with rvm
Then simply
$gem install RedCloth
Unmanaged ruby gems are a pain, I try to avoid them.
None of the answers worked on my Ubuntu 14.04.1 LTS. Upgrade to ruby 2.0 fixed the problem for me:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
sudo gem install bundler
Make sure you also have the build-essential package installed. You can check using
dpkg -l | grep build-essential
or simply install it without checking
sudo apt-get install build-essential
For me on Ubuntu 14.04.1 LTS, after making sure build-essential is installed, the bundle install command works/builds fine also with Ruby 1.9.3.

Gem Command not found

I have installed gem on Ubuntu 10.10 32 bit with
apt-get install gem -y
But when I try to run
gem install something.gem
I get the error of the command not being found.
bash: gem: command not found
I installed gem, is there any reason it is saying it can't find the command?
These files were install by gem package
http://pastie.org/3483416
Try the following:
sudo apt-get install rubygems
Are you wanting ruby gems? If so, you need to install libgemplugin-ruby and then the ruby 'gem' program will be in your path:
aptitude install libgemplugin-ruby
The following command installs ruby gem for ubuntu:
apt-get install libgemplugin-ruby
I did it after ruby was installed.
Installing this package allows you to use gem command on Debian 8:
apt-get install rubygems-integration
To install a gem package you might also need:
apt-get install ruby ruby-dev
On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install rubygems ruby-dev
On CentOS, Fedora or RHEL:
$ sudo yum install rubygems ruby-devel
FWIW, the equivalent package for RHEL/Fedora/CentOS/etc and SuSE/OpenSuSE appears to be called 'rubygems'.
The following command may help you
sudo apt-get install ruby
On Ubuntu 14.04,
apt-get install ruby ruby-dev
this will install gem for you.
On CentOS 7 you can do:
yum -y install rubygems-devel
That worked for me.
I had the same problem. What I did was:
sudo apt-get update
And then reinstall ruby-full
sudo apt-get install ruby-full
check that rvm is a function type rvm | head -1
I know this is kind of late for a response. But I did run into this error and I found a solution here:
https://rvm.io/integration/gnome-terminal
You just have to enable 'Run command as login shell' under the terminal preferences.
The following command will give you the list of files that the gem package installed:
dpkg -L gem
that should help you troubleshoot.
try
$ /usr/bin/pd-gem
or
$ pd-gem
On Centos 8:
eventually, download the file of the application:
wget https://rubygems.org/downloads/asciidoctor-2.0.16.gem
then execute:
yum install -y rubygems ruby-devel
gem install asciidoctor
More: I tried positively also in a container (using the appropriate RUN and COPY statements before the commands).

Resources