waiyan.yoon

Installing dmarkow-raspell gem on MacOS

When you see this error while installing the gem:

2:20:33/user/libraries/avvo_common (master⚡) » gem install dmarkow-raspell -v '1.2.2' -- --with-opt-dir=/opt/homebrew/bin/aspell
Building native extensions with: '--with-opt-dir=/opt/homebrew/bin/aspell'
This could take a while...
ERROR:  Error installing dmarkow-raspell:
        ERROR: Failed to build gem native extension.

    current directory: /Users/user/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/dmarkow-raspell-1.2.2/ext
/Users/user/.asdf/installs/ruby/2.6.6/bin/ruby -I /Users/user/.asdf/installs/ruby/2.6.6/lib/ruby/site_ruby/2.6.0 -r ./siteconf20231115-96329-nkq65n.rb extconf.rb --with-opt-dir\=/opt/homebrew/bin/aspell
checking for ruby.h... yes
checking for aspell.h... no
checking for -laspell... no
creating Makefile

current directory: /Users/user/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/dmarkow-raspell-1.2.2/ext
make "DESTDIR=" clean

current directory: /Users/user/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/dmarkow-raspell-1.2.2/ext
make "DESTDIR="
compiling raspell.c
In file included from raspell.c:2:
./raspell.h:6:10: fatal error: 'aspell.h' file not found
#include <aspell.h>
         ^~~~~~~~~~
1 error generated.
make: *** [raspell.o] Error 1

make failed, exit code 2

Solution

Install aspell in mac using brew

brew install aspell

You will need to specify where is your aspell being installed. For brew users, it's inside the homebrew Cellar:

gem install dmarkow-raspell -v '1.2.2' -- --with-opt-dir=/opt/homebrew/Cellar/aspell/0.60.8

#rubygems-installation-errors