Set Openssl 1.1.1 as a default version - macos

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"

Related

Cannot install old ruby version

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.

How to Install Homebrew on Windows WSL Ubuntu, and fix "zsh: brew command not found" error

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

'scl enable' not setting PATH with bash

I'm trying to use software collections on CentOS 6.8 server, but it won't set the environment variable PATH corectly if the command passed is "bash", but "tcsh" works... (however we don't use tcsh on this machine)
Example:
$ scl --list
devtoolset-4
python27
rh-java-common
rh-perl524
rh-python35
$ which python
/usr/bin/python
$ python --version
Python 2.6.6
$ scl enable python27 bash
$ which python
/usr/bin/python
$ python --version
Python 2.6.6
$ cat /opt/rh/python27/enable
export PATH=/opt/rh/python27/root/usr/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MANPATH=/opt/rh/python27/root/usr/share/man:${MANPATH}
# For systemtap
export XDG_DATA_DIRS=/opt/rh/python27/root/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
# For pkg-config
export PKG_CONFIG_PATH=/opt/rh/python27/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
$ echo $PATH
/usr/share/gridengine/bin/lx26-amd64:/usr/lib64/qt-3.3/bin:/usr/NX/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/maker/bin:/opt/tools/:/opt/tools/amos-3.1.0:/opt/mpich-install/bin:/opt/pssc/bin:/opt/torque/bin:/opt/torque/sbin
$ echo $LD_LIBRARY_PATH
/opt/rh/python27/root/usr/lib64
$ echo $MANPATH
/opt/rh/python27/root/usr/share/man::/opt/mpich-install/share/man:/opt/mpich-install/share/man
So why is MANPATH and LD_LIBRARY_PATH being set properly but not PATH? If i use tcsh it works as expected:
$ scl enable python27 tcsh
$ which python
/opt/rh/python27/root/usr/bin/python
$ python --version
Python 2.7.8
Thank you Dominic you were on to something. I originally checked ~/.bash* files as well as /etc/bash* and /etc/profile but after your comment, I found several scripts in /etc/profile.d/ that we being executed, and one of them set the PATH explicitly without appending. I added $PATH back in there and now scl enable is working as expected!

Why do I need to add ~/.rbenv/bin to my path?

I read in rbenv can't change global ruby version that I need to add ~/.rbenv/bin to my PATH for rbenv to work.
That's also mentioned in the rbenv documentation but that directory doesn't exist as shown below:
$ ls -a ~/.rbenv/
. .. plugins shims version versions
So why do I need to add a directory that doesn't exist to my path for rbenv to work?
Edit:
#theTinMan, I tried uninstall and reinstalling, but I still don't have a ~/.rbenv/bin path. Where are you seeing in the documentation that it should be there?
$ rbenv --version
rbenv 1.0.0
$ which rbenv
rbenv () {
local command
command="$1"
if [ "$#" -gt 0 ]
then
shift
fi
case "$command" in
(rehash | shell) eval "$(rbenv "sh-$command" "$#")" ;;
(*) command rbenv "$command" "$#" ;;
esac
}
$ cd
$ ls .rbenv
plugins shims version versions
$ brew list | grep rbenv
rbenv
$
$ brew uninstall rbenv
Uninstalling /usr/local/Cellar/rbenv/1.0.0... (36 files, 61.9K)
rbenv 0.4.0 is still installed.
Remove all versions with `brew uninstall --force rbenv`.
$ brew uninstall --force rbenv
Uninstalling rbenv... (32 files, 49.9K)
$ brew install rbenv
==> Summary
🍺 /usr/local/Cellar/rbenv/1.0.0: 36 files, 62K
$ ls .rbenv
plugins shims version versions
$ rbenv -v
rbenv 1.0.0
$ rbenv versions
system
2.0.0-p648
* 2.3.1 (set by /Users/max/.rbenv/version)
$
I had the following in my .zshrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
But I only needed the bottom line
# export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

-bash: gcc: command not found - Mavericks

I have installed
Xcode 5
Command line tools
gcc with homebrew
But when I try to use gcc command it says:
-bash: gcc: command not found
The location
gcc -version -bash: gcc: command not found
bolo:~ Michelin$ ls /usr/bin/gcc-4.2 /usr/bin/gcc-4.
http://cl.ly/image/3m2U1N0q1B2l
update
bolo:~ Michelin$ xcode-select -p
Usage: xcode-select -print-path
or: xcode-select -switch <xcode_folder_path>
or: xcode-select -version
Arguments:
-print-path Prints the path of the current Xcode folder
-switch <xcode_folder_path> Sets the path for the current Xcode folder
-version Prints xcode-select version information
bolo:~ Michelin$ xcode-select -print-path
/Applications/Xcode.app/Contents/Developer
and
bolo:~ Michelin$ locate */bin/gcc
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc
/Library/Developer/CommandLineTools/usr/bin/gcc
bolo:~ Michelin$
update (12:18pm)
on my system
bolo:~ Michelin$ ls /usr/local/bin/gc
gcc-4.2 gcov-4.2
My bash_profile
export PATH=/usr/local/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
source ~/.rvm/scripts/rvm
and after.
bolo:~ Michelin$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/Michelin/.rvm/bin
Thanks
Ok probleme solved. I have replaced my bin folder by other one and now every works.
Maverick is not came with .bash_profile. Need to change bash_profile using vim or nano command.
Edit with following...
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc

Resources