How to setup XDebug for PHP7 on Mac? - macos

I've installed PHP 7 on my mac using Homebrew i.e.
$ brew install php70
Also I want to have the the XDebug setup on my machine.
Ideally I would love to have an easy solution like using brew again, but unfortunately it seems there is no such formula exist (at least yet), and the latest package is homebrew/php/php56-xdebug.
I thought before start the manual installation, check here to see if there are any other workaround.
Any advice will be greatly appreciated.

First, make sure you're on the version of PHP for which you want Xdebug installed. It needs to be installed separately for each major version (7.0 vs 7.1 vs 7.2). You can check your version using php -v.
Then, run pecl install xdebug.
Once it's finished installing, you'll see a message like this:
Installing '/usr/local/Cellar/php/7.2.8/pecl/20170718/xdebug.so'
Then go to your php.ini (which you can find by running php --ini, and add these two lines to it:
zend_extension="/usr/local/Cellar/php/7.2.8/pecl/20170718/xdebug.so"
xdebug.remote_enable=on
Obviously, change the path to whatever was printed by the pecl xdebug installation.

It is available in Homebrew now as homebrew/php/php71-xdebug.

Try:
brew install php71-xdebug
and if that doesn't work:
brew install --build-from-source php71-xdebug
Source: xdebug install on php70

As stated by Homebrew, Homebrew/php tag was deprecated.
So it's not possible to install xdebug through Homebrew anymore. Please use PECL instead: https://xdebug.org/docs/install#pecl

Since Brew is no longer working, you can use pecl to install the debugger.
It's not as good as brew, you may run into dependency problems but it works. Install php with brew, whatever version you want, then use pecl.
brew install php
pecl install xdebug

Xdebug 2.4.0beta1 already supports PHP 7. Unfortunately the only way for installation for now is to compile it from the source code.

If brew install php71-xdebug is not working, and it returns this error:
Error: No available formula with the name "php71-xdebug"
Try run this command first: brew tap homebrew/php .

Related

How to install php 5.6 with homebrew if from this year it is EOL?

Because php 5.6 is EOL from 01.01.2019, it was removed from homebrew.
How can I install it with homebrew even if it is not in core?
I just used shivammathur/homebrew-php without any problems.
brew tap shivammathur/php
brew install shivammathur/php/php#5.6
The repository is on Github:
https://github.com/shivammathur/homebrew-php
(the exolnet/homebrew-deprecated mentioned in other answers doesn't seem to work anymore)
brew tap exolnet/homebrew-deprecated
brew install php#5.6
source: https://joostvanveen.com/a-29/install-and-configure-multiple-php-versions-on-mojave-with-homebrew
I tried exolnet/homebrew-deprecated but it have some problem with xdebug & pecl. So I recommend you use official one.
Ref this because of long post:
https://devhoi.com/threads/install-brew-deprecated-php-version-php-7-1-5-6-7-0-on-brew-macos.25/
https://devhoi.com/threads/how-to-install-old-deprecated-packages-on-brew.32/

Unable to install package using luarocks on osx

I installed lua on my OSX 10.10 machine using brew install lua. The version that got installed was 5.2.4. LuaRocks was installed along with the lua package. But when i run luarocks install <package_name> i get Error: ##HOMEBREW_PREFIX## does not exist and your user does not have write permissions in. i tried using sudo luarocks install <package_name> as well, but it gives the same error. How to fix this ?
Please Help.
Thanks
This was a bug in the way we relocate text files to ensure wider bottle portability for non-/usr/local users.
It was resolved a couple of weeks back, July 31st I believe. Presuming your Homebrew is in a standard location, if you do:
rm /usr/local/etc/luarocks52/config-5.2.lua && brew update && brew reinstall lua
The problem should be resolved now. Apologies!
I had the same problem when using the luarocks when installed with homebrew, try installing luarocks again like this:
$ wget http://luarocks.org/releases/luarocks-2.2.1.tar.gz
$ tar zxpf luarocks-2.2.1.tar.gz
$ cd luarocks-2.2.1
$ ./configure; sudo make bootstrap
I took this code snippet from here: https://luarocks.org/
I managed to install all the modules that I required without problems after doing this.

Mcrypt PHP extension installation doesn't work

I am trying to install laravel via composer ( http://laravel.com/docs/quick#installation ) and I got stuck at the point where it requires Mcrypt extension
Mcrypt PHP extension required.
I installed Mcrypt extension using brew. But still it throws the same requirement error.
I also tried changing the path as suggested here but my which php doesn't show anything other than
/usr/bin/php
Am I doing something wrong with assigning path at ~/.bash_profile? why is "which php" output still the same. and why is mcrypt installation not working on laravel workout?
What command did you use to install mcrypt? It is possible that you try to install the mcrypt extension for the wrong php version.
Try debugging the situation with
php -v
and
ls -al /usr/bin/php
There is a different install recipe for version 5.5 and 5.4 of PHP.
brew install php54-mcrypt
brew install php55-mcrypt
OK, I was fed up off all other solutions which weren't working, so finally downloading and compiling php from source itself worked.
So here's what I did:
Download php from official site
Follow following instructions
cd to/extracted/php/folder
cd /ext/mycript
phpize
./configure
make
make test
sudo make install
Add extension=mcrypt.so to /etc/php.ini file.
Now restart the server
sudo apachectl restart
You are good to go, Cheers! :)

How can I install GNU Octave on Mac with Fink ?

I tried to install GNU Octave on my Mac using Fink by this instruction
http://wiki.octave.org/Octave_for_MacOS_X
I think I have followed all the instructions but I can't run Octave.
How can I check if it is installed correctly?
I tried typing 'octave' in the terminal but it says 'command not found'
Or, is there any easy instruction for Octave installation?
I've found many install guides but they are all different and assumes some knowledge.
Incidentally, I have installed Octave GNU today twice on two different machines (both running Lion).
I needed the latest version of Octave (3.6.4), and used Homebrew.
I already had XCode installed, so the rest:
Install Homebrew
Based on the instructions in this page, I ran:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Install Octave
Following this guide, I ran:
brew tap homebrew/science
brew update && brew upgrade
brew install gfortran
brew install octave
Install AquaTerm
Notice that you need this before you install gnuplot (or gnuplot won't see aqua as a valid terminal and you may get 'unknown or ambiguous terminal type' error).
Simply downloaded the latest version (1.1.0) dmg from SourceForge.
Install gnuplot
brew install gnuplot
You could try installing it with Home Brew. Once you download and install Home Brew, use this guide to get Octave installed.
Easiest option would be using the precompilled .app
I've tried the precompiled .app, but had issues with certain functions (like sound),
whereas the macports version always worked.
I usually install it using macports:
sudo port install octave
for the basics.
You might need other port variants/octave modules installed:
sudo port install octave octave-signal octave-plot octave-image octave-signal
Need to have XCode with Command Line Tools first and Macports with this route though
How to know if a Fink package is installed
By default (and this should be your case too if you didn't changed it), Fink installs everything under /sw, i.e. the binaries you are looking for should be in /sw/bin/.
Run ls /sw/bin/octave*and, depending on the output, you then have two choices :
Either the Octave binary is inside /sw/bin, in that case run echo $PATH and learn more about PATH Variable to fix your problem.
Otherwise, if there is nothing inside, there might have been a problem with the install. Try running fink install octave once more, look closely at the output and update your post if necessary.
This is simply an update on the instruction provided by Izhaki (that I ran on Mac OSX 10.8.4).
You may be required to update XCode to 4.6.3. This can be done through the AppStore.
If you encounter the error:
Error: Download failed: http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130613oss_src.tgz
during
brew install octave
Then invoke:
brew update
brew install octave
and the install will pick up where it left off. Other than that, the instruction worked seamlessly.

Error Installing Jekyll - Native Extension Build

I'm having some trouble installing jekyll. Can't quite figure out how to patch the missing link. I think it's an update to Ruby, but RVM is having trouble installing alternate versions of ruby as well.
Heres the full post:
$ sudo gem install jekyll
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1/ext/gem_make.out
Does this mean I need to update the version of ruby I'm using via rvm?
Ubuntu
sudo apt-get install ruby-dev
gem install jekyll
Your problem is that either you system doesn't know where make is located at or you don't have it installed. The easiest way to fix this (and probably other issues you'll run into trying to get a ruby system up and running) is to install xcode.
You can get it at http://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12 for lion. Or it came on a CD with your computer for earlier versions.
If you're using Lion, please see comments below for a link to how to install developer tools on Lion.
I had the same error on Ubuntu and this helped me sort it out.
You must have ruby-dev installed
apt-get install ruby-dev
If you installed XCode and command line tools are still missing go to Terminal and
xcode-select --install
it will prompt you to install these tools. After that just follow SrBlanco´s answer. That solved the problem for me.
Good luck.
Need to install "make".
I am using Ubuntu 12.10.
sudo apt-get install make
Should work on any Debian based distro.
Note: this problem also occurs on newer MacBook Pro models that come with Mavericks pre-installed. I updated another post with my own solution that didn't involve Xcode at all. My system had the Xcode developer tools installed when I got the machine.
ERROR: Error installing jekyll: ERROR: Failed to build gem native extension
Install Xcode as mentioned if you don't have it installed already (https://developer.apple.com/xcode/). Plus you need the command line tools.
Open Xcode. Go to Preferences > Downloads > Install Command Line Tools
Installing command line tools for Xcode solved the problem for me on my Mac
xcode-select --install.
sudo apt-get install ruby-dev
sudo gem install jekyll
hope this will help, it works with me.
I had this same exact error when trying to install Jekyll, and the following steps from this link helped me. Just in case anyone else comes across this!
http://davidensinger.com/2013/03/installing-jekyll/
I was facing the same issue in my Fedora 22 setup. I had ruby installed but didn't have ruby-devel. Installing ruby-devel fixed the issue for me.
dnf install -y ruby-devel
For older systems:
yum install -y ruby-devel
I followed this on Ubuntu/Linux Mint
sudo apt install build-essential
sudo apt install ruby-dev
sudo gem install jekyll
An addendum: You can install XCode now from the App Store on Mountain Lion. The process is transparent and pretty fast.
I had the same problems with you.
I use Mac OS X 10.9 develop preview version, and I had installed gcc and Xcode.
But my Xcode version is 4.6.
Then I install the Xcode 5.0
After that I type sudo gem install jekyll in the terminal again. Then it works.
Wish it could help someone.
Installing Xcode and going to perferencs > downloads > install commandline tools WORKS!
Same problem on Debian, I had forgot to run this command:
~/.rvm/scripts/rvm
All these answers did NOT work for me.
If you're looking for a solution on ubuntu 14.04, do this:
sudo apt-get install ruby1.9.1-dev zlib1g-dev nodejs
sudo gem install jekyll -v 2.5.3
Unfortunately, nodejs is required because of a bug in Jekyll that enforces existence of runtime JS engine even though it doesn't need one.
For Ubuntu, this helped in my case:
apt-get install libffi-dev
A general advice is to just follow what is displayed as the reason for the error and hopefully you'll be provided with a log file in which the first line suggests which package should be installed, in my case:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.21/mkmf.log
MacOS
my solution to this problem
install xcode
type xcode-select --install in the command line
type sudo gem install jekyll in the command line
PS: It is the combination of the two answers in this question.
You are missing the ruby-dev file , just go ahead and run this command - sudo apt-get install ruby-dev
Hope this helps!!
I had the same issue on my macOS(10.14.2), the reason may be:
Apparently with OSX el Capitan, there is a new security function that prevents you from modifying system files called Rootless.
My solution is using rvm:
install ruby on Mac OS X with RVM
gem install jekyll
On windows I have this issue
I actually installed the version rubyinstaller-devkit-2.6.3-1-x64 of ruby
I have removed the ruby completely and Installed the rubyinstaller-devkit-2.5.5-1-x64
and issued the following commands on powershell
gem install bundler
gem install jekyll
and this time no errors where found
I had this issue and of all things, the error was occurring because I hadn't agreed to some updated terms of service in xcode. Running the following did the trick for me. Go figure.
sudo xcodebuild -license accept
For me, I had to upgrade homebrew and install rbenv to the latest ruby version. After that, I followed the instruction at jekyll website. My OS is Catalina 2019, I couldn't install Xcode, which is not compatible yet!
You have to set the path in your .bash_profile to make sure that it initializes the rbenv when you restart your terminal.
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
then
$ rbenv version
2.2.3 (set by /Users/mislav/.rbenv/version)
$ rbenv shell
rbenv: no shell-specific version configured
hope that help!
Here is the (only?) reliable and simple way to install Jekyll on macOS
Install UTM
Install Ubuntu Server
Install Jekyll using Ubuntu instructions at https://jekyllrb.com/docs/installation/ubuntu/
Forward port 22 in the VM settings (22->localhost->22)
Use VS Code on the macOS host
Install Remote SSH
Connect to USER#localhost
Drag and drop the folder on Mac into VS Code (this transfers files to remote)
Enable port forwarding for 4000 (bottom bar on VS Code)
Work on your website
Right click on your website on the file explorer and click download
If you have not done these steps, you might be delighted by:
Ubuntu imports your public SSH key from GitHub
VS Code magically handles file transfer in and out
VS Code magically installs your VS Code extensions onto the remote server and allows file search on the remote host

Resources