Categories
Dev Technology

Installing Compass on macOS Catalina

Upgrading a Mac Operating System to a newer version brings a lot of cool new features, but it can also bring some compatibility issues.

I ran into this problem after formatting the MacBook Pro with a clean install of macOS Catalina. But I think it can also occur when upgrading straight from High Sierra (previous version of Catalina).

The issue

When trying to run the command gem install compass the following errors are prompt from the terminal window. These are some of the tips following tips that helped me solve the problem after doing some research.

mkmf.rb can’t find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out
prompt has been recorded in the error log here gem_make.out this file, you can go directly from the finder view.

The solution

After hours of research and several trial and errors, I came to this method to solve the problem.

First I ran a system update, this is the first step from the Compass docs prior the install.

$ gem update —system

The next step is to first grab the installer and execute some commands that will let the system choose another Ruby version rather than the one that comes with macOS Catalina by default.

$ curl -L https://get.rvm.io | bash -s stable
$ rvm install ruby-2.6
$ rvm use ruby-2.6.3
$ rvm -—default use 2.6.3

Once the proper version of Ruby is installed, the last thing needed is to run the Compass installation command.

$ gem install compass

If writing permissions errors are prompted, you may want to use sudo. Although this practice is not recommended, it can let you run the command.

Conclusion

As said before, a new Mac Operating System can break or bring incompatibility issues in your dev environment.

It is very important to be aware of this prior an major update. Fortunately, the dev community is very generous and as soon as this issues are spotted, everyone is willing to raise their issues and share solutions.

Further info

2 replies on “Installing Compass on macOS Catalina”

This is an old version of ruby, that generates errors when trying to install some frameworks like rails, sass, compass, etc…
The correct approach should be: rvm use ruby –install -default This in order to install the current stable version of ruby and not an already deprecated version.

Thanks for your comment! This worked for me after a lot of failed attempts. I’m running SASS and Compass without any issues in the same MacBook Pro.

Leave a Reply to Mariano D'Acosta Cancel reply

Your email address will not be published. Required fields are marked *