Showing posts with label Homebrew. Show all posts
Showing posts with label Homebrew. Show all posts

Thursday, February 24, 2022

How to set memory for Solr on MacOS (installed via homebrew)

Modify this file /opt/homebrew/Cellar/solr/X.XX/homebrew.mxcl.solr.plist to add these lines

<key>EnvironmentVariables</key>

<dict>

  <key>SOLR_JAVA_MEM</key>

  <string>-Xmx2g</string>

</dict>


Save and restart Solr


$ brew services restart solr

Friday, March 29, 2013

[Fixed][VIM] E354: Invalid register name: '*'

This error occurs when you or some of your vim plugins try to access register '*' which is a system clipboard. In default Mac OSX vim, it is compiled without system clipboard support enable. You can check this by run command :version inside vim. In the result, you will see -clipboard. Disable is -, enable is +.

To solve this issue, you need to compile vim with +clipboard yourself. I suggest OSX users to use brew to help this process. Out-of-the-box brew compiles vim with +clipboard. To do this run
brew install vim
Then you might need to create a new symbolic link from your vi command to point to the newly installed vim.
First you need to know the path of your new vim. Run
brew info vim
You should see something similar to /usr/local/Cellar/vim/7.3.875 in the result which means your vim binary file is at /usr/local/Cellar/vim/7.3.875/bin/vim. To create a new symbolic link for vi, first you need to remove the existing link
sudo rm /usr/bin/vi
Then you can create a new link.
sudo ln -s /usr/local/Cellar/vim/7.3.875/bin/vim /usr/bin/vi

Thursday, January 31, 2013

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

I ran to this issue couples of week ago
Installing oj (2.0.2) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/viki/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
>>>>> Creating Makefile for ruby version 1.9.3 on x86_64-darwin11.4.0 <<<<<
creating Makefile

make
compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
compiling load.c
compiling oj.c
compiling saj.c
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://developer.apple.com/bugreporter/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/qw/xj8ns4cn09jfv1x5qq1mhn7m0000gn/T/saj-4CFmfe.i
clang: note: diagnostic msg: /var/folders/qw/xj8ns4cn09jfv1x5qq1mhn7m0000gn/T/saj-4CFmfe.sh
make: *** [saj.o] Error 254


Gem files will remain installed in /Users/viki/.rvm/gems/ruby-1.9.3-p194@raynor/gems/oj-2.0.2 for inspection.
Results logged to /Users/viki/.rvm/gems/ruby-1.9.3-p194@raynor/gems/oj-2.0.2/ext/oj/gem_make.out

I could find the way to fix it. It was quite frustrated at that moment because the only way to get passed this error to start our web server again is to downgrade oj gem.

But eventually, I found the way to fix it. As I understand, this error causes by bug in llvm (Apple's gcc that comes with XCode). Here is the steps of how I fixed the issue.

First you need to install gcc4.2 with brew

brew update
brew tap homebrew/dupes
brew install apple-gcc42
Then reinstall your Ruby with this command (I use RVM)

CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 rvm install 1.9.3-pXXX
After this you should be able to install oj or the other gems as usual.

I composed solution from many links but sorry I forgot to take note of those.



Collectd PostgreSQL Plugin

I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresq...