Force sudo to inherit environment variables

I had a little trouble getting Cython to build on my Mavericks setup lately and found that I could overcome the issue by telling clang to ignore unused parameters that were actually designed to be sent to gcc. We can do this with the  -Qunused-arguments flag. However, we can’t simply do this:

As the drop into sudo starts with a fresh set of env vars. The solution is dead simple:

The -E flag forces sudo to inherit the env vars. Of course, we also could have just done this:

Leave a Reply