Improved environment and brew path detection.