Nginx install on Mac OS X Lion. Cannot find PCRE - nginx

First up, I am trying to compile everything form source, I'm not using MacPorts or HomeBrew.
I have already installed pcre to /usr/local/pcre-8.21 and symlinked this to /usr/local/pcre.
I have set /usr/local/pcre/bin to my PATH variable here.
`/usr/local:/usr/local/mysql/bin:/usr/local/pcre/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin`
I am now trying to install Nginx, but I keep getting this message:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
I tried setting --with-pcre=/usr/local/pcre/bin but it just tries to re-install PCRE.
Can anyone help me get round this?
Thanks.

Nginx requires PCRE – Perl Compatible Regular Expressions(http://www.pcre.org/)
download PCRE and install PCRE:
cd pcre-8.01
./configure --prefix=/usr/local
make
sudo make install
in nginx folder type in to install:
cd nginx-0.8.33
./configure --prefix=/usr/local --with-http_ssl_module
make
sudo make install

The answer may already be found, but I still want to add my answer.
When you use ./configure you should use --with-pcre=/path/to/pcre/source. So let's say the source code was saved in /usr/local/src/pcre then the command will look like this:
./configure --with-pcre=/usr/local/src/pcre
Hope this helps someone!

I faced the same problem. These commands solved my problem:
Open MAC terminal and run this command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
then Run:
brew install pcre
Done!
Source: http://macappstore.org/pcre-2/

Related

Jupyterlab - find and replace globally ( all files and in all directories )

Is there any way to find and replace text string automatically in all folder's files? similar to what we get in sublime text, VS code etc
In JupyterLab you can open a terminal. Depending on the OS you use, you can use the tools from that OS to do the job. On Linux for example you can use find and sed to replace:
find path/to/folder -type f -exec sed -i 's/replace this/with this/g' {} \;
Other than that I do not think that this is a built-in functionality in JupyterLab.
You can install jupyterlab-search-replace extension, for example with pip:
pip install jupyterlab-search-replace
and the required ripgrep, for example on Ubuntu:
sudo apt-get install ripgrep
If you use a conda environment you can just install both with:
conda install -c conda-forge jupyterlab-search-replace ripgrep
For up-to-date installation instructions see the GitHub repository of the extension.
This extension requires JupyterLab 3 or newer.

Automator Shell Script- Sass Compiling Shell Script no longer works [duplicate]

I am not able to install and run fakes3 gem on El Capitan Beta 5.
I tried:
sudo gem install fakes3
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/fakes3
Then I tried doing it the cocoapods way. It worked for cocoapods but not for fakes3.
mkdir -p $HOME/Software/ruby
export GEM_HOME=$HOME/Software/ruby
gem install cocoapods
[...]
1 gem installed
gem install fakes3
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Disclaimer: #theTinMan and other Ruby developers often point out not to use sudo when installing gems and point to things like RVM. That's absolutely true when doing Ruby development. Go ahead and use that.
However, many of us just want some binary that happens to be distributed as a gem (e.g. fakes3, cocoapods, xcpretty …). I definitely don't want to bother with managing a separate ruby. Here are your quicker options:
Option 1: Keep using sudo
Using sudo is probably fine if you want these tools to be installed globally.
The problem is that these binaries are installed into /usr/bin, which is off-limits since El Capitan. However, you can install them into /usr/local/bin instead. That's where Homebrew install its stuff, so it probably exists already.
sudo gem install fakes3 -n/usr/local/bin
Gems will be installed into /usr/local/bin and every user on your system can use them if it's in their PATH.
Option 2: Install in your home directory (without sudo)
The following will install gems in ~/.gem and put binaries in ~/bin (which you should then add to your PATH).
gem install fakes3 --user-install -n~/bin
Make it the default
Either way, you can add these parameters to your ~/.gemrc so you don't have to remember them:
gem: -n/usr/local/bin
i.e. echo "gem: -n/usr/local/bin" >> ~/.gemrc
or
gem: --user-install -n~/bin
i.e. echo "gem: --user-install -n~/bin" >> ~/.gemrc
(Tip: You can also throw in --no-document to skip generating Ruby developer documentation.)
In my case, I had to re-install Ruby using Brew. That seems to have solved the problem as I can install gems again.
brew install ruby
After this, you need to log out and log back in, either graphically or just restarting your terminal.
That is because of the new security function of OS X "El Capitan".
Try adding --user-install instead of using sudo:
$ gem install *** --user-install
For example, if you want to install fake3 just use:
$ gem install fake3 --user-install
sudo gem install -n /usr/local/bin cocoapods
Try this. It will definately work.
You have to update Xcode to the newest one (v7.0.1) and everything will work as normal.
If after you install the newest Xcode and still doesn't work try to install gem in this way:
sudo gem install -n /usr/local/bin GEM_NAME_HERE
For example:
sudo gem install -n /usr/local/bin fakes3
sudo gem install -n /usr/local/bin compass
sudo gem install -n /usr/local/bin susy
Looks like when upgrading to OS X El Capitain, the /usr/local directory is modified in multiple ways :
user permissions are reset (this is also a problem for people using Homebrew)
binaries and symlinks might have been deleted or altered
[Edit] There's also a preliminary thing to do : upgrade Xcode...
Solution for #1 :
$ sudo chown -R $(whoami):admin /usr/local
This will fix permissions on the /usr/local directory which will then help both gem install and brew install|link|... commands working properly.
Solution to #2 :
Ruby based issues
Make sure you have fixed the permissions of the /usr/local directory (see #1 above)
First try to reinstall your gem using :
sudo gem install <gemname>
Note that it will install the latest version of the specified gem.
If you don't want to face backward-compatibility issues, I suggest that you first determine which version of which gem you want to get and then reinstall it with the -v version. See an exemple below to make sure that the system won't get a new version of capistrano.
$ gem list | grep capistrano
capistrano (3.4.0, 3.2.1, 2.14.2)
$ sudo gem install capistrano -v 3.4.0
Brew based issues
Update brew and upgrade your formulas
$ brew update
$ brew upgrade
You might also need to re-link some of them manually
$ brew link <formula>
As it have been said, the issue comes from a security function of Mac OSX since "El Capitan".
Using the default system Ruby, the install process happens in the /Library/Ruby/Gems/2.0.0 directory which is not available to the user and gives the error.
You can have a look to your Ruby environments parameters with the command
$ gem env
There is an INSTALLATION DIRECTORY and a USER INSTALLATION DIRECTORY. To use the user installation directory instead of the default installation directory, you can use --user-install parameter instead as using sudo which is never a recommanded way of doing.
$ gem install myGemName --user-install
There should not be any rights issue anymore in the process. The gems are then installed in the user directory : ~/.gem/Ruby/2.0.0/bin
But to make the installed gems available, this directory should be available in your path. According to the Ruby’s faq, you can add the following line to your ~/.bash_profile or ~/.bashrc
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
Then close and reload your terminal or reload your .bash_profile or .bashrc (. ~/.bash_profile)
This is the solution that I have used:
Note: this fix is for compass as I wrote it on another SO question, but I have used the same process to restore functionality to all terminal processes, obviously the gems you are installing are different, but the process is the same.
I had the same issue. It is due to Apple implementing System Integrity Protection (SIP). You have to first disable that...
Reboot in recovery mode:
Reboot and hold Command + R until you see the apple logo.
Once booted select Utilities > Terminal from top bar.
type: csrutil disable
then type: reboot
Once rebooted
Open terminal back up and enter the commands:
sudo gem uninstall bundler
sudo gem install bundler
sudo gem install compass
sudo gem install sass
sudo gem update --system
The the individual gems that failed need to be fixed, so for each do the following:
On my machine this was the first dependency not working so I listed it:
sudo gem pristine ffi --version 1.9.3
Proceed through the list of gems that need to be repaired. In all you are looking at about 10 minutes to fix it, but you will have terminal commands for compass working.
Screenshot
If the gem you are trying to install requires xml libraries, then try this:
sudo gem install -n /usr/local/bin <gem_name> -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
Specifically, I ran into a problem while installing the nokogiri gem v 1.6.8 on OS X El Capitan
and this finally worked for me:
sudo gem install -n /usr/local/bin nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
To make sure you have libxml2 and libxslt installed, you can do:
brew install libxml2 libxslt
brew install libiconv
and then check to make sure you have xcode command line tools installed:
xcode-select --install
should return this error:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Reinstalling RVM worked for me, but I had to reinstall all of my gems afterward:
rvm implode
\curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm reload
I ran across the same issue after installing El Capitan, I tried to install sass and compass into a symfony project, the following command returned the following error:
$ sudo gem install compass
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ffi.h... /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
So I then tried to install sass with:
$ sudo gem install sass
Got the same error message, after some googling I managed to install sass using the following command:
$ sudo gem install -n /usr/local/bin sass
The above worked for me with installing sass but did not work for installing compass. I read that someone somewhere had opened an instance of xcode then closed it again, then successfully ran the same command after which worked for them.
I attempted to open xcode but was prompted with a message saying that the version of xcode installed was not compatible with El Capitan.
So I then updated xcode from the app store, re-ran the following command which this time ran successfully:
$ sudo gem install -n /usr/local/bin compass
I was then able to run $ compass init
I now have all my gems working and can proceed to build some lovely sass stuff :)
I had to rm -rf ./vendor then run bundle install again.
You might have two options:
If you've installed ruby and rails, you can first try running the command:
rvm fix-permissions
You can uninstall ruby completely, and reinstall in your ~ directory aka your home directory.
If you're using homebrew the command is:
brew uninstall ruby
For rails uninstall without homebrew the command is:
rvm remove
This should reinstall the latest ruby by running command:
curl -L https://get.rvm.io | bash -s stable --rails<br>
Mac has 2.6.3 factory installed, and it's required... if not run this command:
rvm install "ruby-2.6.3"
and then:
gem install rails
You'll get a few error messages at the end saying you have to add some other bundles...
Just make sure you're in the home ~ directory when you're installing so the permissions won't be an issue, but just in case...
I again ran:
rvm fix-permissions
and:
rvm debug
which told me I had to download yarn, I didn't save the output for it. Basically I did whatever the prompt told me to do if it had to do with my OS.
-D
I don't like to install stuff with sudo.
once you start with sudo you can't stop..
try giving permissions to the Gems directory.
sudo chown -R $(whoami) /Library/Ruby/Gems/2.0.0
sudo chown -R $(whoami):admin /usr/local
That will give permissions back (Homebrew installs ruby there)

nginx installed successfully but cannot start

I use homebrew to install nginx. However, when I start nginx, it prompts:
dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
Referenced from: /usr/local/bin/nginx
Reason: Incompatible library version: nginx requires version 4.0.0 or later, but libpcre.1.dylib provides version 2.0.0
Trace/BPT trap: 5
Any ideas?
I had this same problem, try running this:
brew unlink pcre && brew link pcre
In my case, this was the output:
Unlinking /usr/local/Cellar/pcre/8.35... 5 symlinks removed
Linking /usr/local/Cellar/pcre/8.35... 133 symlinks created
Well, I don't know what causes the problem. I checked my pcre, and it was in latest version. Without option I just uninstall it and reinstall it again...Then it works...
Only thing that fixed it for me was reinstalling everything in brew.
https://gist.github.com/nmccready/adfae27c498e0795767f
I run the following and it sorted the issue for me
brew update && brew upgrade && brew rm extempore && brew install extempore
If you get any problem in nginx then you can debug using this command:
nginx -t
after running this command you will get error message including filename and line number where the problem is

error: with-readline=yes (default) and headers/lib are not available

I am trying to install RHadoop. I have used following instruction in a Virtual box Ubuntu 12.04 64 bit version.
$wget https://launchpad.net/ubuntu/quantal/+source/r-base/2.15.1-3ubuntu1/+files/r-base_2.15.1.orig.tar.gz
$ tar -zxvf r-base_2.15.1.orig.tar.gz
$ sudo apt-get install gfortran
$ cd R-2.15.1/
$ ./configure --with-x=no
When I run this command, I get the error mentioned above. Google also does not have any suggestions for this error although many talk about X11
Readline is a GNU package that you can find here; your first option consists in installing it before trying to build R again.
Alternatively, if you are sure you do not need R to be built with this library, you can simply set with-readline to "no":
./configure --with-x=no --with-readline=no
Setting readline to no is something I considered, but than think of this, what if you need it. I am not even sure what it is 100%, but I assume it lets R read from user input of some sort.
Anyways, I just resolved this error by installing readline-devel on centos via yum. On debian I think it's something like libreadline-dev. The point is that you need development files which include .h files necessary for R.
This solution works for me:
error: --with-x=yes (default) and X11 headers/libs are not available
Solution:
Code:
$ sudo apt-get install xorg-dev
For Centos 7, to install X11
# yum install xorg-x11-server-devel libX11-devel libXt-devel
Now ./configure

C compiler gcc not found while installing passenger and nginx

I'm trying to install Passenger and Nginx on my VPS.
I followed these instructions and replaced all links of all sources to the current version.
But when i ran the Phusion Passenger installer for Nginx, something with gcc compiler went wrong:
Compiling and installing Nginx...
# sh ./configure --prefix='/opt/nginx' --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt='-Wno-error' --add-module='/usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.17/ext/nginx'
checking for OS
+ Linux 2.6.32-220.el6.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler gcc is not found
What should I do?
OBS: My VPS works with CentOS 6.2 x64
Have the same problem and the following commands solve it; (on ubuntu server)
sudo apt-get install linux-kernel-headers
sudo apt-get install build-essential
If you do have gcc installed, the problem stems from /tmp being mounted as noexec. The error doesn't exactly help, but if you remount /tmp as exec you can install passenger properly.
mount -o remount,rw,exec,nosuid /tmp
Got the same error. Just installed gcc and it started working:
yum install gcc
same problem here and I found out that I am not able to run command as root
has to use
sudo
and it worked like charm
Be sure that you sudo, if applicable.
Example:
sudo ./configure ...
One quick hack (I struggled a lot with it and finally install pre-built) is to install the pre-built package of Nginx rather than compiling it from source.
For RHEL/CentOS create the file named /etc/yum.repos.d/nginx.repo with the following contents:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
In above baseurl replace “OS” with “centos” and “OSRELEASE” with “6”.
Finally execute yum install nginx
Reference https://nginx.org/en/linux_packages.html#stable

Resources