Tuesday, November 18, 2014

Run gedit on Mac OS terminal

This post shows how to run gedit on Mac OS terminal. gedit is a text editor on Ubuntu, which can be started on Ubuntu terminal. To have the same function of running gedit as a command line in Mac OS, first need to download it from the following link:

https://wiki.gnome.org/Apps/Gedit

After downloading and installation, open the .bash_profile in your $HOME directory by running the following commands in the Mac terminal:

$cd $HOME
$touch .bash_profile
$open .bash_profile

Once the .bash_profile is opened, add the following lines to the end:

export GEDITPATH=/Applications/gedit.app/Contents/MacOS/gedit
export PATH=$GEDITPATH:$PATH


Now save the .bash_profile and run the following command to update the environment var in the terminal:

$source .bash_profile

Now enter the following command in the terminal to start gedit:

$./gedit

You may notice some errors message such as the ones below:

dyld: Symbol not found: _xmlBufContent
  Referenced from: /usr/lib/libxslt.1.dylib
  Expected in: /Applications/gedit.app/Contents/Resources/lib/libxml2.2.dylib
 in /usr/lib/libxslt.1.dylib

Trace/BPT trap: 5

This may be due to libxml2 or libxslt is not installed or the libxml2.2.dylib not in the lib folder of gedit, to install them, run the following commands:

$brew install libxml2
$brew install libxslt
$cp /usr/local/Cellar/libxml2/2.9.1/lib/libxml2.2.dylib /Applications/gedit.app/Contents/Resources/lib

(Change the 2.9.1 to your version of libxml2). Rerun the following command:

$./gedit

No comments:

Post a Comment