Ruby on Silicon

Setting up M1 MBP today (Hurray!)


But I'm having issues with Ruby installation. I'm using chruby and ruby-install.


TextMate and Rails is having trouble.


I think I `brew install automake bison openssl readline libyaml gdbm libffi`, `brew install automake bison openssl readline libyaml gdbm libffi`, `brew install ruby-install`, `ruby-install ruby`, `sudo gem install rails` (because wouldn't go without sudo). But now `gem install pg` fails


Building native extensions. This could take a while...

ERROR: Error installing pg:

ERROR: Failed to build gem native extension.


current directory: /Users/gscar/.gem/ruby/3.0.2/gems/pg-1.2.3/ext

/Users/gscar/.rubies/ruby-3.0.2/bin/ruby -I /Users/gscar/.rubies/ruby-3.0.2/lib/ruby/3.0.0 -r ./siteconf20211029-6743-ntd38g.rb extconf.rb

checking for pg_config... no

No pg_config... trying anyway. If building fails, please try again with

--with-pg-config=/path/to/pg_config

checking for libpq-fe.h... no

Can't find the 'libpq-fe.h header

*** 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.


I have a folder at root level named src which contains a folder ruby-3.0.2 and file ruby-3.0.2.tar.xz. Was this created as part of the ruby install. Also ~/.rubies/ruby-3.0.2/bin/ruby. Lots of other files and folders in ~/.rubies/ruby-3.0.2.


Why does `gem install pg` fail?


I also have a Ruby script that I can run from the command line, but not TextMate.


I'm using the same .zshrc as worked on my 2103 MBP.


Thanks for any ideas. I assume it's a path problem of some sort.





MacBook Pro 16″, macOS 12.0

Posted on Oct 29, 2021 1:01 PM

Reply

Similar questions

3 replies

Oct 29, 2021 1:31 PM in response to SoCalMtnBiker

As long as you have homebrew 3.3.1 installed in /opt/homebrew (Apple Silicon only) and your PATH adjusted accordingly (/opt/homebrew/bin), you can separately install the Ruby Version Manager (RVM) and then tell it to use homebrew to reconcile any dependencies prior to the Ruby 3.0.2 installation. If homebrew automatically installed the Apple Command-line tools for you, then:


rvm install 3.0.2


will build arm64 ruby binaries (including gem module compiles, and the gem updates for ruby v3.0.2, and add the Pry and Rubocop gems. RVM installs the specified Ruby version in your home directory under the .rvm (hidden) folder. You can interactively choose between multiple Ruby versions, including the default Apple installed Ruby.


What I have described here is what I personally use on Big Sur 11.6.1, and earlier. I won't have this setup in Monterey until late next week, as I am waiting on new hardware.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Ruby on Silicon

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.