I am unable to install ruby 2.4.2
My setup must allow me to use nvm and rvm, and I need to use ruby versions 2.7.2 and 2.4.2. I suspect you may find multiple problems with my openssl and rvm setup. Also, I am not sure which version of openssl is appropriate for me. I am using macOS Monterey Version 12.3.1.
When I do:
rvm install 2.4.2
I see this error in my ..._ruby-2.4.2/configure.log
configure: error: something wrong with
LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
The following info may relate to the problem:
openssl version # LibreSSL 2.8.3
~/.zshrc
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/sbin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
export ZSH="$HOME/.oh-my-zsh"
HIST_STAMPS="dd/mm/yyyy"
plugins=(git)
source $ZSH/oh-my-zsh.sh
export PATH="/opt/homebrew/opt/openssl#1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
export RUBY_CFLAGS="-DUSE_FFI_CLOSURE_ALLOC"
~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
export PATH="$PATH:$HOME/.rvm/bin"
~/.bash_profile
PATH="~/.rvm/gems/ruby-2.7.2/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin/sqlite3:$PATH"
export NVM_DIR=~/.nvm
source ~/.bashrc
# Disabled the next line
# source ~/.profile
alias start_puma="bundle exec puma -p 3000 -S ~/puma -C config/puma.rb"
parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
setopt PROMPT_SUBST
export PROMPT='%F{grey}%n%f %F{cyan}%~%f %F{green}$(parse_git_branch)%f %F{normal}$%f '
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
I identified two problems:
My LDFLAGS had the wrong path in ~/.zshrc
I did not understand why openssl version produced LibreSSL 2.8.3
I found the correct path to the LDFLAGS within the errors produced by brew reinstall openssl#1.1. The errors included:
For compilers to find openssl#1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
The response to openssl version is still LibreSSL 2.8.3 and I assume this is correct.
I have also learned that ~/.zshrc must include source ~/.bash_profile, and that ~/.bash_profile must include source ~/.bashrc.
I am now able to open a new shell window and see the correct results for rvm list (listing the available ruby versions) and nvm list (listing the available node versions).
I am also able to install the ruby versions I want.
Related
I have macOS BigSur 11.6. When I run openssl version I get
LibreSSL 2.8.3
What I want is to get this output:
OpenSSL 1.1.1l 24 Aug 2021
In the /usr/local/opt/ there are folders: openssl, openssl#3, openssl#1.1.
I ran these commands:
brew install openssl
brew reinstall openssl#3
sudo ln -sfn /usr/local/Cellar/openssl#1.1 /usr/local/opt/openssl
I placed the line export PATH="/usr/local/opt/openssl#1.1/bin:$PATH" in files ~/.profile, ~/.bash_profile, ~/bashrc.
But nothing helps. How can I make the default openssl version 1.1?
Plese, don't offer commands as in this or this questions. These commands don't change anything: as soon as I open a new session I get the same LibreSSL 2.8.3 instead of opessl 1.1.1l
export PATH="/usr/local/opt/openssl#1.1/bin:$PATH"
source ~/.profile
source ~/.bash_profile
source ~/.bashrc
UPD 1
type -a openssl shows:
openssl is /usr/bin/openssl
echo $PATH shows:
/usr/local/opt/libressl/bin:/usr/local/opt/python#3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
UPD 2
Just made unset PATH, set in files ~/.profile, ~/.bash_profile, ~/bashrc the same line export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl#1.1/bin:$PATH" and ran this line in bash. Anyway there is the same output for openssl version: LibreSSL 2.8.3.
this bash --norc -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin; set -x; source ~/.bash_profile' shows:
+ source /Users/sgalich/.bash_profile
++ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl#1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
++ PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl#1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
++ export LDFLAGS=-L/usr/local/opt/openssl#1.1/lib
++ LDFLAGS=-L/usr/local/opt/openssl#1.1/lib
++ export CPPFLAGS=-I/usr/local/opt/openssl#1.1/include
++ CPPFLAGS=-I/usr/local/opt/openssl#1.1/include
++ export CPATH=/usr/local/opt/openssl#1.1/include
++ CPATH=/usr/local/opt/openssl#1.1/include
++ export LIBRARY_PATH=/usr/local/opt/openssl#1.1/lib
++ LIBRARY_PATH=/usr/local/opt/openssl#1.1/lib
++ export DYLD_LIBRARY_PATH=/usr/local/opt/openssl#1.1/lib
++ DYLD_LIBRARY_PATH=/usr/local/opt/openssl#1.1/lib
++ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/openssl#1.1/lib
++ DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/openssl#1.1/lib
So the issue was in my PATH variable. My problem was solved after adding this line in the ~/.bash_profile:
PATH="/usr/local/opt/openssl#1.1/bin:$PATH"
Thanks #Gordon Davisson for the answer!
On MacOS Monterey (with M1 chip) the paths differed.
I added the following to ~/.zshrc
export PATH="/opt/homebrew/opt/openssl#1.1/bin:$PATH"
Installation was a series of 5 simple steps:
first, install homebrew itself from command in the home page:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
After that, following instructions in this page, and changing ~/.bash_profile to ~/.profile as I am using Ubuntu as my wsl distro, i had to give these commands:
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
But now, when I try to run brew, I get command not found error.
In a wsl environment, brew is installed at location: /home/linuxbrew/.linuxbrew/ which is not part of the path.
So we simply need to add that to path, and it works. I am using zsh as my shell, so I add these lines to my ~/.zshrc file (in ubuntu file system) :
export BREW_HOME="/home/linuxbrew/.linuxbrew/bin"
export PATH="$PATH:$BREW_HOME"
if you happen to need to share your .zshrc across different OS, you can do some OS check in your zshrc file to see if it is macOS or linux/wsl:
case `uname` in
Linux)
## add brew home to PATH in linux/WSL
brew_home=/home/linuxbrew/.linuxbrew
if [ -d "${brew_home}" ]; then
export PATH=${brew_home}/bin:$PATH
fi
javac_loc=/usr/bin/javac
if [ -x "$javac_loc" ]; then
export JAVA_HOME=$(readlink -f $(dirname $(readlink -f $javac_loc)))
fi
;;
Darwin)
## Do macOS thing...
export JAVA_HOME=$(/usr/libexec/java_home)
;;
esac
I am trying to run 'gem install bundler' on a new macbook pro.
I get :
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
I have tried using RVM
I have tried using RBENV
rbenv doctor gives this output:
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20190423)
Counting installed Ruby versions: 1 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK
My bash profile is like this:
alias brewup='brew update; brew upgrade; brew cleanup; brew doctor'
###
## Colors and prompt customisation
## OLD: export> PS1="\[\033[36m\]\u\[\033[m\]#\[\033[32m\]\h:\[\033[33;1m\] \w\[\033[m\] \$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1=" \[\033[01;35m\]\u#\h: \[\033[01;32m\]\w \[\033[01;34m\]\$(parse_git_branch) \[\033[01;34m\]\n>\[\e[0m\]"
## NVM stuff
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
## Ruby rbenv stuff
eval "$(rbenv init -)"
export PATH="/usr/local/sbin:$PATH"
export PATH="/Users/georgeclark/.gem/ruby/2.3.7/bin:$PATH"
the last 3 lines are vague attempts at getting this working, could well be wrong.
The output from some terminal commands I ran are as follows:
If I do ruby -v
I get: ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
which gem gives me /Users/georgeclark/.rbenv/shims/gem
output from:
echo $PATH, ls -l ~/.rbenv/shims, rbenv versions, gem env
is:
/Users/georgeclark/.rbenv/shims:/Users/georgeclark/.gem/ruby/2.3.7/bin:/usr/local/sbin:/Users/georgeclark/.nvm/versions/node/v10.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin, ls -l /Users/georgeclark/.rbenv/shims, rbenv versions, gem env
These seem ok.. just cant figure out why it wont run, and really don't want to use sudo 😕
It was my bad.
I wasn't setting the rbenv properly.
Once I set this up with:
rbenv global 2.4.5
Then all works fine.
I am attempting to install RVM and a few gems from a single bash script that I use to bootstrap a new development box. My goal is to have a single script I can run on a clean install of OSX to install any and everything I use for development.
After installing RVM, I am sourcing the $HOME/.rvm/scripts/rvm script, however in the next line, when I attempt to install a specific version of ruby, it says rvm is not found. Here is my script.
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --autolibs=homebrew
source "$HOME/.rvm/scripts/rvm"
rvm install 2.1.1
rvm use 2.1.1
gem install jekyll
gem install tmuxinator
gem install scss-lint
I can't understand why this isn't working, because if I run each command individually in the terminal, everything works great.
Any ideas on a 1 script solution to install RVM, a specific version of Ruby, and a few gems?
If you look in .bashrc after RVM they have:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
What I would do overall for cleanliness
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --autolibs=homebrew
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
. "$HOME/.rvm/scripts/rvm"
else
echo "$HOME/.rvm/scripts/rvm" could not be found.
exit 1
fi
export PATH="$PATH:$HOME/.rvm/bin"
rvm use 2.1.1 --default --install
for i in jekyll tmuxinator scss-lint; do gem install $i; done
You may need to add "source ~/.rvm/scripts/rvm" to your ~/.bash_profile file.
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc
To install rvm:
rm -rf ~/.rvm
curl -L https://get.rvm.io | bash -s stable
In your script type:
type_rvm=$(type rvm | head -n 1)
echo "type rmv: $type_rvm"
You could try export rvm:
export PATH=$PATH:/opt/rvm/bin:/opt/rvm/sbin
I found a solution after reading through another stack overflow post.
A comment to one of the answers suggested makeing sure the script runs with bash and not sh. That was my problem. After changing the top line of my script (which wasn't included in my example) from #!/bin/sh to #!/usr/bin/env bash, everything worked as expected.
$ shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'
Login shell
$ type rvm | head -n 1
rvm is a function
-bash: type: write error: Broken pipe
However:
$ rvm --default use 1.9.2
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
I removed ~/.rvm/ and tried installing again using curl -L https://get.rvm.io | bash -s stable --auto but that doesn't help.
It's a remote Ubuntu 13.04, that I have ssh'd into, authenticating with keys. Any advice?
I was sourcing the ~/.rvm/bin/rvm script twice. In the process of uninstalling and reinstalling, it once happened to not modify ~/.bash_profile. I then did this manually. A second uninstall/re-install dance then produced a ~/.bash_profile of:
source ~/.bashrc
# (lines added by me)
if [ -f /ubuntu/.rvm/bin/rvm ]; then
source '/ubuntu/.rvm/bin/rvm' > /dev/null
fi
# (lines added by RVM installer using: curl -L https://get.rvm.io | bash -s stable --auto-dotfiles)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*