Sphinx installation error ''invalid option --pgsql"

388 Views Asked by At

My system is MAC OS Big Sure. I wanted to add sphinx to my project but faced problem. When I enter command:

 brew install sphinx --pgsql --mysql 

I got an error:

 Error: invalid option: --pgsql

Part of my gemfile:

gem 'rails', '~> 6.1.3', '>= 6.1.3.2'
     gem 'mysql2', '~> 0.5.3'
    gem 'thinking-sphinx'

And this causes a lot of problems later - I cannot make indexing for my project and make my sphinx search work properly. I am not sure that problem is is exactly in Sphinx, so maybe someone also faced this problem? I already have mysql and postgresql installed. UPDATE: Maybe, it would be useful, when I'm trying to index Sphinx - it gives me out this warning:

WARNING: index 'post_core': preload: failed to open /Users/user_name/RubymineProjects/app_name/db/sphinx/development/post_core.sph: No such file or directory; NOT SERVING
1

There are 1 best solutions below

0
pat On

Unfortunately, Homebrew's version of Sphinx no longer supports configuration to build with PostgreSQL. From a Rails/Thinking Sphinx perspective, that means if your database is PostgreSQL, and you're using SQL-backed indices (:with => :active_record in your index definitions), then you can't use Homebrew to install Sphinx.

Instead, your best option is to download the precompiled version of Sphinx 2.2.11 for macOS from Sphinx's website: http://sphinxsearch.com/downloads/archive/ … and then you'll have to copy the files within the bin folder of your archive into somewhere more permanent (possibly /usr/local/bin/.).

Sphinx v3 has issues with PostgreSQL databases, hence why I'm not recommending that in this particular situation.

However, if you're using MySQL for your application database, or if you're using real-time indices (:with => :real_time), then you could look into using one of the more current Sphinx releases (that also have the advantage of working with MySQL v8+). Again, you'll need to use the pre-compiled binaries, as Homebrew's version is stuck at v2.2.11. http://sphinxsearch.com/downloads/current/