I can't seem to get ruby-build to work on OSX. Any ideas?
ruby-build 2.2.0 ~/local/ruby-2.2.0
ruby-build: use openssl from homebrew
Downloading ruby-2.2.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.bz2
Installing ruby-2.2.0...
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.12.4 using ruby-build 20170405)
Inspect or clean up the working tree at /var/folders/jp/bhxfpbm904nctz6j03rm2drh0000gp/T/ruby-build.20170427123529.78803
Results logged to /var/folders/jp/bhxfpbm904nctz6j03rm2drh0000gp/T/ruby-build.20170427123529.78803.log
Last 10 log lines:
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... yes
checking whether LDFLAGS is valid... no
configure: error: something wrong with LDFLAGS="-L/Users/User/local/ruby-2.2.0/lib "
make: *** No targets specified and no makefile found. Stop.
Also:
rbenv install 2.4.1
ruby-build: use openssl from homebrew
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
Installing ruby-2.4.1...
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.12.4 using ruby-build 20170405)
Inspect or clean up the working tree at /var/folders/jp/bhxfpbm904nctz6j03rm2drh0000gp/T/ruby-build.20170427123718.79852
Results logged to /var/folders/jp/bhxfpbm904nctz6j03rm2drh0000gp/T/ruby-build.20170427123718.79852.log
Last 10 log lines:
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... yes
checking whether LDFLAGS is valid... no
configure: error: something wrong with LDFLAGS="-L/Users/User/.rbenv/versions/2.4.1/lib "
make: *** No targets specified and no makefile found. Stop.
mkdir -p /Users/User/.rbenv/versions/2.4.1/lib does not fix it.
relevant config.log:
configure:7554: checking whether CFLAGS is valid
configure:7567: clang -c -g -O2 conftest.c >&5
configure:7567: $? = 0
configure:7568: result: yes
configure:7579: checking whether LDFLAGS is valid
configure:7599: clang -o conftest -g -O2 conftest.c >&5
clang: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead [-Wliblto]
configure:7599: $? = 0
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define CANONICALIZATION_FOR_MATHN 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:7605: result: no
configure:7607: error: something wrong with LDFLAGS=""
I had a similar issue. Turned out that I had the following in my .bash_profile. Commenting it out fixed my issues. I have a feeling this led to some conflicts with system libraries
#export LIBRARY_PATH=/opt/local/lib:/usr/local/lib
Can we please have this fixed? It cripples user experience.
$ rbenv install 2.4.1 [12:38:41]
ruby-build: use openssl from homebrew
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
Installing ruby-2.4.1...
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.13.1 using ruby-build 20170914)
Inspect or clean up the working tree at /var/folders/dn/bdsfszyj63569bgkwf1jsrw80000gn/T/ruby-build.20171007123914.61416
Results logged to /var/folders/dn/bdsfszyj63569bgkwf1jsrw80000gn/T/ruby-build.20171007123914.61416.log
Last 10 log lines:
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... no
configure: error: something wrong with CFLAGS="-I/usr/local/include -L/usr/local/lib "
5.97s user 4.92s system 75% cpu 14.433 total
FAIL: 1
I know that setting CFLAGS='' is a way to bypass this bug but this is not an excuse for having a broken default behaviour. Clearly the CFLAGS value is valid but somehow ruby-builds seems to consider itself as being too smart.
For me the issue was the $PATH variable, not the $LIBRARY_PATH.
@ssbarnea double check your .bash_profile/.bashrc/.profile and environment variables.
In case anybody else runs into this issue recently, the LDFLAGS error was occuring when I was trying to rbenv install 2.5.3. I tried setting the path, reinstalling openssl, and other suggestions but what eventually solved it was to upgrade XCode from 9.4 to the latest 10.1
I faced this issue on Mojave when I was using an older version of Xcode. (I had downgraded to 9.4 from 10.3). I resolved this issue by installing latest version of Command Line Tools and running:
sudo xcode-select -s /Library/Developer/CommandLineTools
I faced this issue on Mojave when I was using an older version of Xcode. (I had downgraded to 9.4 from 10.3). I resolved this issue by installing latest version of Command Line Tools and running:
sudo xcode-select -s /Library/Developer/CommandLineTools
Yup, I'm running more than one xcode as an older version is a dependancy for an older rails project that I have. I've got a newer version in /Applications, so using that let me install:
sudo xcode-select -s /Applications/Xcode.app/
I was running into openssl related issue:
Error running './configure --prefix=/Users/<user>/.rvm/rubies/ruby-2.7.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/libksba:/usr/local/opt/readline:/usr/local/opt/zlib:/usr/local/opt/[email protected] --disable-install-doc --enable-shared',
Ran brew install openssl
then it told to reinstall run: brew reinstall [email protected], so I re-installed
Then at the end, it said to add these vars in .zshrc
If you need to have [email protected] first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
so i added these in .zshrc:
# openssl 1.1
PATH="/usr/local/opt/[email protected]/bin:$PATH"
LDFLAGS="-L/usr/local/opt/[email protected]/lib"
CPPFLAGS="-I/usr/local/opt/[email protected]/include"
PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
to get these in my already opened terminal, I ran source ~/.zshrc
the updating ruby using rvm worked: rvm install "ruby-2.7.0"
I run the following:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
And then run
rvm install "ruby-2.7.0"
it's working with me.
Most helpful comment
I faced this issue on Mojave when I was using an older version of Xcode. (I had downgraded to 9.4 from 10.3). I resolved this issue by installing latest version of Command Line Tools and running:
sudo xcode-select -s /Library/Developer/CommandLineTools