“Python quit unexpectedly” when launching vim with YouCompleteMe

The native python provided by macOS conflicts with the python version installed via homebrew. And if we have compiled our YouCompleteMe plugin for me against the native python earlier, we will essentially run into a problem.

This is explained on YouCompleteMe’s github issue tracker – https://github.com/Valloric/YouCompleteMe/issues/585

Resolving the problem simply requires us to unset our python path and reinstalling our homebrew python libraries again.

brew uninstall --ignore-dependencies --force python python@2
brew install python python@2
cd ~/.vim/bundles/YouCompleteMe
./install.sh --all

Valgrind on Mac OS X (10.10) Yosemite

The trunk version of valgrind seems to be compiling properly on Mac OS X (10.10.2), Xcode 6.2.

Here’s my self-explanatory build script:

#! /usr/bin/env bash

mkdir -p buildvalgrind
cd buildvalgrind
svn co svn://svn.valgrind.org/valgrind/trunk/@14960 valgrind
cd valgrind
./configure --prefix=/usr/local
make && sudo make install

# check that we have our valgrind installed
/usr/local/bin/valgrind --version

UPDATE: r15088 works for Xcode 6.3 commandline tools. r14960 as shown in the build script above only works for Xcode 6.2 commandline tools. Julian Seward (the valgrind creator himself) gave me the heads-up.

svn diff -c15088
Index: configure.ac
--- configure.ac (revision 15087)
+++ configure.ac (revision 15088)
@@ -154,7 +154,7 @@
# Note: m4 arguments are quoted with [ and ] so square brackets in shell
# statements have to be quoted.
case "${is_clang}-${gcc_version}" in
- applellvm-5.1|applellvm-6.0*)
+ applellvm-5.1|applellvm-6.*)
AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])

P.S.: This is an update to the original post here https://calvinx.com/2014/05/04/valgrind-on-mac-os-x-10-9-mavericks/

Managing Cabal sandbox environment

Cabal is the defacto build tool for building packages in the haskell universe. Unfortunately, it was not designed to be a package manager for haskell and has some limitations. The most recent improvement to cabal was the introduction of cabal sandboxes, which goes a long way to help haskell developers avoid the infamous cabal hell.

Still, the utilities for cabal sandbox are generally rough on the edges, so here’s a few shell functions and wrapper functions I have written to make it easier to automate the management of cabal sandbox environment – https://github.com/calvinchengx/cabalenv

It works much like python’s virtualenv/virtualenvwrapper, you can easily switch to a particular cabal environment with a single command and set your cabal sandbox’s bin directory into your `$PATH`.

A few convenient wrapper functions like `ghcis`, `ghc` and `runhaskells` (notice the “s”) also help us avoid specifying the `-package-db` flag everytime we want `ghci` or `ghc` or `runhaskell` to use the cabal sandbox package database. `cabal exec — runhaskell` does the same thing of course, but I am just too lazy to type such lengthy command.

So there you go, a simple shell script (`zsh` at the moment) to simplify the management of my cabal sandbox environment for my haskell projects and experiments.