Category Archives: mac os

How to enable localhost on Mac OSX 10.10 (Yosemite)

Problem

I’ve upgraded my mac os to the latest version. Besides getting slower, my previous apache server configuration stopped working.

Solution

The Web Sharing option ceased to exist, and there’s now more manual configuration necessary. The link below worked perfectly for me:

https://donatstudios.com/PHP-in-OS-X-Yosemite

Advertisements

Gtags on emacs

In a previous post about emacs etags, I received a tip from Alex Ott suggesting gtags for C/C++.

Installing

On MacOS, you can get gtags through mac ports, installing the “global” package.

Usage

To build the symbols table, it’s simple as doing:

gtags

at the root of the project.

Usage on emacs

First, you need to add a gtags-mode on emacs and tell it where to find the gtags script if gtags.el file is not installed in the default location (mac ports install it on /opt/local/share/gtags by default). On the preferences files, I added these lines:

(setq load-path (cons "/opt/local/share/gtags/" load-path))                                                                                                             
(autoload 'gtags-mode "gtags" "" t)  

Some useful commands:

  • gtags-find-tag [tag name] — this command finds the definition of tag name.
  • gtags-find-rtag [tag name] — this command finds the usage of the tag name
  • gtags-find-tag-from-here — this command is a smart version of the above. It will look up the name that is pointed by your cursor. If your cursor is on a definition, it will look for usage. On the other hand, if your cursor is on a usage, it will look for the definition.

One may wish to bind this last command to some key.

Reference

http://www.gnu.org/s/global/globaldoc.html

Cmake syntax highlighting for aquamacs

Aquamacs does not offer syntax highlighting for cmake files for default. To change that, download the parser from cmake website: http://www.cmake.org/CMakeDocs/cmake-mode.el

Then, add the following lines in the configuration file for aquamacs, usually in: ~/Library/Preferences/Aquamacs Emacs/Preferences.el

; Add cmake listfile names to the mode list.
(setq auto-mode-alist
	  (append
	   '(("CMakeLists\\.txt\\'" . cmake-mode))
	   '(("\\.cmake\\'" . cmake-mode))
	   auto-mode-alist))

(autoload 'cmake-mode "~/CMake/Docs/cmake-mode.el" t)

Source:

http://www.itk.org/Wiki/CMake_Editors_Support

How to solve linker dependencies on Mac OS X

I got the following error message when compiling a code, even though I’d already passed the correct include/library paths.

dyld: Library not loaded: libboost_filesystem.dylib
Referenced from: /Users/kunigami/dev/osl/build/macosx/shaders/../oslc/oslc
Reason: image not found

This happend because I built boost from source and kept it local. Thus the path to the library was not the default one. To solve this problem we have to edit the environment variable DYLD_LIBRARY_PATH, which is analogous to linux LD_LIBRARY_PATH:

export DYLD_LIBRARY_PATH=/Users/kunigami/dev/boost/lib:$DYLD_LIBRARY_PATH