Tag Archives: homebrew

hombrew: brew install gxargs

The xargs utility on Mac is not the same as the one on linux. In particular, searching for files with the mdfind utility will not properly escape files to be processed. Using homebrew you can install the GNU version of xargs as gxargs, and you can use the syntax you’re accustomed to from GNU/Linux. For me this is equivalent to something like: mdfind -name “conflicted copy” | gxargs -d ‘\n’ -P 4 echo To remove the files you can then replace echo with rm – but be careful!

Posted in Mac | Tagged , | Leave a comment

How to install pecl pecl_http with homebrew php54 / php55

You may be tempted to try and run pecl install pecl_http if you’re using homebrew on Mac OS X in order to be able to access functions like http_get_request_headers – but there’s a better way. Instead, try using the command brew install php54-http or brew install php55-http ( depending on if you are using php 5.4 or php 5.5 with homebrew ) You can get more info about pecl_http with homebrew by using brew info php54-http or brew info php55-http ( again depending on your PHP version ). If you have already tried pecl install pecl_http you may want to run pecl uninstall pecl_http before running the other commands. If you have previously used something like brew install php54-http and now it doesn’t seem to be loading, check your configuration file in /usr/local/etc/php/5.4/conf.d or try doing: brew remove php54-http And then running: brew install php54-http

Posted in Tech Tips | Tagged , | Leave a comment

SSH Autocompletion – Disable using /etc/hosts – brew

I use the bash-completion keg from homebrew to get better bash-completion on Mac OS X. You can install it with brew install bash-completion You can also get some information about it using: brew info bash-completion It will tell you something like: bash-completion: stable 1.3 http://bash-completion.alioth.debian.org/ /usr/local/Cellar/bash-completion/1.3 (187 files, 1.1M) * From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/bash-completion.rb ==> Caveats Add the following lines to your ~/.bash_profile: if [ -f $(brew –prefix)/etc/bash_completion ]; then . $(brew –prefix)/etc/bash_completion fi Homebrew’s own bash completion script has been installed to /usr/local/etc/bash_completion.d Bash completion has been installed to: /usr/local/etc/bash_completion.d To find out where the file that does all the work is stored, run: echo $(brew –prefix)/etc/bash_completion It will probably tell you something like: /usr/local/etc/bash_completion That file has a lot of comments in it, one of the gems being: _known_hosts_real() # Helper function for completing _known_hosts. # This function performs host completion based on ssh’s config and known_hosts # files, as well as hostnames reported by avahi-browse if # COMP_KNOWN_HOSTS_WITH_AVAHI is set to a non-empty value. Also hosts from # HOSTFILE (compgen -A hostname) are added, unless # COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value. # Usage: _known_hosts_real [OPTIONS] CWORD # Options: -a Use aliases # -c Use `:’ suffix # -F configfile Use `configfile’ for configuration settings # -p PREFIX Use PREFIX # Return: Completions, starting with CWORD, are added to COMPREPLY[] The short story is that if you set up something in your ~/.bash_profile file like this: export COMP_KNOWN_HOSTS_WITH_HOSTFILE=”” #don’t use /etc/hosts for ssh autocomplete Then your ssh autocomplete … Continue reading

Posted in Tech Tips | Tagged , , | Leave a comment

Hombrew Upgrade PHP54 – make ext/ldap/ldap.lo Error 1

If you are trying to upgrade brew / homebrew’s PHP54 package by josegonzalez – especially if you have oci8.so / pdo_oci.so you might be getting an error like this: The actual text of the message is something like: $ brew upgrade Updated Homebrew from 5b3410b6 to 44c284ff. ==> Upgrading 2 outdated packages, with result: php54 5.4.22, php54-mcrypt 5.4.22 ==> Upgrading php54 ==> Downloading http://www.php.net/get/php-5.4.22.tar.bz2/from/this/mirror Already downloaded: /Library/Caches/Homebrew/php54-5.4.22 Warning: Backing up all known pear.conf and .pearrc files Warning: If you have a pre-existing pear install outside of homebrew-php, or you are using a non-standard pear.conf location, installation may fail. ==> ./configure –prefix=/usr/local/Cellar/php54/5.4.22 –localstatedir=/usr/local/var –sysconfdir=/usr/local/etc/php/5.4 –with-config-file-path=/usr/local/etc/php/5 ==> make rc = ldap_sasl_interactive_bind_s(ld->link, binddn, ctx->mech, NULL, NULL, LDAP_SASL_QUIET, _php_sasl_interact, ctx); ^ 11 errors generated. make: *** [ext/ldap/ldap.lo] Error 1 make: *** Waiting for unfinished jobs…. READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting If reporting this issue please do so at (not mxcl/homebrew): https://github.com/josegonzalez/homebrew-php/issues ==> Upgrading php54-mcrypt Warning: Could not link php54. Unlinking… Why does this happen? In my case it was because I installed oracle instaclient and was using that alongside homebrew. It has library files referenced in /usr/local/include and they don’t play nice when you upgrade PHP / php54 with homebrew. How do I fix it? Open terminal and change to /usr/local/include/ Type in something like ls -al | grep ldap to be presented with something like this: lrwxr-xr-x 1 user group 52B Nov 19 21:37 ldap.h -> /usr/local/instantclient/ Copy and paste that – make sure you write down the path of where that symlink is pointing. … Continue reading

Posted in Tech Opinion | Tagged , , , , | 1 Comment

brew install gnu-stat

The stat command on Ubuntu and OS X behave differently and I’d like to have the functionality of the GNU / Ubuntu version of stat available on OS X – if there is such a thing. I have already used homebrew to install gnu-sed and I see similarly that a lot of the GNU utilities are available from: brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt I know stat on OS X might be very specialized because of the OS X file systems that may be present, but I’d ALSO like to have the linuxy version if it is available. As it turns out, it is. The GNU version of stat can be accessed on OS X by installing a package / keg called coreutils which includes the following utilities: base64 env mknod runcon touch basename expand mktemp seq tr cat expr mv sha1sum true chcon factor nice sha224sum truncate chgrp false nl sha256sum tsort chmod fmt nohup sha384sum tty chown fold nproc sha512sum uname chroot groups numfmt shred unexpand cksum head od shuf uniq comm hostid paste sleep unlink cp id pathchk sort uptime csplit install pinky split users cut join pr stat vdir date kill printenv stty wc dd link printf sum who df ln ptx sync whoami dir logname pwd tac yes dircolors ls readlink tail dirname md5sum realpath tee du mkdir rm test echo mkfifo rmdir timeout These GNU utilities are available on Mac OS X but the one caveat is that they are … Continue reading

Posted in Mac, Server Admin, Tech Tips | Tagged , , , | Leave a comment

Installing php apc with homebrew

I’ve been enjoying using the keg homebrew-php by josegonzalez in order to run the latest versions of PHP, like PHP 5.4 on Mac running OS X 10.8 Snow Leopard. I also like to use Ubuntu on some cloud web servers and have been noticing a huge improvement in performance when the php module apc is installed / enabled. Recently I learned that I can get this same performance boost on in my development environment on my mac by using apc here too. Just install it with homebrew: brew install php54-apc The module will be installed and enabled, and on my system it created a new config file called ext-apc.ini in the directory /usr/local/etc/php/5.4/conf.d and it has some great defaults: [apc] extension=”/usr/local/Cellar/php54-apc/3.1.10/apc.so” apc.enabled=1 apc.shm_segments=1 apc.shm_size=64M apc.ttl=7200 apc.user_ttl=7200 apc.num_files_hint=1024 apc.mmap_file_mask=/tmp/apc.XXXXXX apc.enable_cli=0 One key here is that apc.shm_size needs to be set, and that it also needs to have the suffix M or I guess you could use K if you wanted a really small shm_size but honestly 64M works pretty great.

Posted in Mac, Web Development | Tagged , | Leave a comment

Error: couldn’t connect to server shell/mongo.js:84 – SOLVED

I was having an issue on Mac OS X – this is probably because I installed it with homebrew a few months back and forgot about these instructions. $mongodb MongoDB shell version: 2.0.6 connecting to: test Sat Jun 16 09:11:43 exception: connect failed Error: couldn’t connect to server shell/mongo.js:84 I search for a solution but didn’t easily find one, so I ended up uninstalling it and reinstalling it, which then gave me the very valuable notes below about where config files and data paths are stored on OSX, and also let me know that I needed to start the service if I wanted to use it. Here are those notes: Downloading http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.6.tgz Already downloaded: /Users/me/Library/Caches/Homebrew/mongodb-2.0.6-x86_64.tgz Caveats If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/mongodb/2.0.6-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist If this is an upgrade and you already have the homebrew.mxcl.mongodb.plist loaded: launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist cp /usr/local/Cellar/mongodb/2.0.6-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist Or start it manually: mongod run –config /usr/local/etc/mongod.conf The launchctl plist above expects the config file to be at /usr/local/etc/mongod.conf Summary /usr/local/Cellar/mongodb/2.0.6-x86_64: 18 files, 122M, built in 2 seconds You might want to run brew update and brew upgrade to update / upgrade all of your homebrew packages, or brew update and brew upgrade mongodb to update mongodb to the latest version. A few other notes if you’re using homebrew: # updates the database of available software and what the latest # available version for each is. run this … Continue reading

Posted in Mac, Tech Tips | Tagged , , , | Leave a comment