Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting exports in Fish Shell

I have multiple versions of PHP installed, and for my normal development I always use PHP 5.5.x installed via homebrew.

In the fish shell

 which php & php --version
=> /usr/local/bin/php
=> PHP 5.5.8 (cli) (built: Jan 16 2014 15:58:25)

The path is correct.

My problem is that when I have to develop with Drupal I use MAMP as a bundled lamp stack, and MAMP has its own php version included. My problem is that when using Drush with Drupal I cannot set the PHP executable path as I normally would in bash. I only want drush to use the bundled PHP version/executable.

In bash I can do this:

# Set Drush root to MAMP PHP
export DRUSH_PHP=/Applications/MAMP/bin/php/php5.5.3/bin/php

But this wont work in fish-shell, I tried with this (no success):

fish config location: ~/.config/fish/config.fish

set -x DRUSH_PHP=/Applications/MAMP/bin/php/php5.5.3/bin/php

If I run the fishshell with drush statusi always get this:

 Drupal version         :  7.26
 Site URI               :  http://default
 Database driver        :  mysql
 Database username      :  root
 Database name          :  dev-db
 Default theme          :  garland
 Administration theme   :  garland
 PHP executable         :  /usr/local/bin/php
 PHP configuration      :  /usr/local/etc/php/5.5/php.ini
 PHP OS                 :  Darwin
 Drush version          :  6.2.0
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Applications/MAMP/htdocs/Sandbox/dev
 Site path              :  sites/default
 File directory path    :  sites/default/files

And when I run the same command in bourne shell I get the correct settings:

  Drupal version                  :  7.26                                        
  Site URI                        :  http://default                              
  Database driver                 :  mysql                                       
  Database username               :  root                                        
  Database name                   :  dev-db                                      
  Database                        :  Connected                                   
  Drupal bootstrap                :  Successful                                  
  Drupal user                     :  Anonymous                                   
  Default theme                   :  bartik                                      
  Administration theme            :  seven                                       
  PHP executable                  :  /Applications/MAMP/bin/php/php5.5.3/bin/php 
  PHP configuration               :  /Applications/MAMP/bin/php/php5.5.3/conf/php.ini                                       
  PHP OS                          :  Darwin                                      
  Drush version                   :  6.2.0                                       
  Drush configuration             :                                              
  Drush alias files               :                                              
  Drupal root                     :  /Applications/MAMP/htdocs/Sandbox/dev       
  Site path                       :  sites/default                               
  File directory path             :  sites/default/files                         
  Temporary file directory path   :  /Applications/MAMP/tmp/php   

So, how to set the export path to the DRUSH_PHP in fish?

like image 661
pat Avatar asked Feb 07 '14 09:02

pat


People also ask

How do you set up a fish shell?

Simply run fish_config to open the web client. From there, you can choose the themes, colors, prompts, inspect the FSH functions and variables, and see the history of commands used. Changes are, in turn, stored in the ~/. config/fish folder and can be accessed and edited there to dodge the optional web configuration.

How do I customize my fish prompt?

fish is empty by default. To create a custom prompt create a file ~/. config/fish/functions/fish_prompt. fish and fill it with your prompt.


1 Answers

Derp.

The syntax was a little different, but I figured it out. Anyone having this issue, you can set an export as this:

set -x DRUSH_PHP /Applications/MAMP/bin/php/php5.5.3/bin/php

and drush gets the correct PHP exec path.

See the set documentation to understand how set works in Fish as opposed to other shells. Basically:

set variable value
like image 186
pat Avatar answered Oct 20 '22 16:10

pat