index rss mastodon twitter github linkedin email
Álvaro Ramírez
sponsor

Álvaro Ramírez

28 March 2016 Emacs Objective-C tagging with RTags

Install libclang on Mac

brew install llvm --with-clang

Install RTags

git clone --recursive https://github.com/Andersbakken/rtags.git
cd rtags
cmake -DCMAKE_PREFIX_PATH=/Users/your-user-name/homebrew/opt/llvm -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .
make

Start RTags daemon

path/to/rtags/bin/rdm 2> /tmp/rdm.log

Compilation database

Install xctool

brew install xctool

Generate a compilation database

cd path/to/your/objc-project
xctool -sdk iphonesimulator -arch x86_64 -scheme SomeScheme -reporter pretty -reporter json-compilation-database:compile_commands.json clean build

Load compilation database

path/to/rtags/bin/rc -J path/to/your/objc-project/compile_commands.json

Install RTags Emacs package

(use-package rtags :ensure t
  :config
  (setq rtags-use-helm t) ;; Optional. Enable if helm fan (I am!).
  (setq rtags-path "path/to/rtags/bin/"))

Ready to go

Use any of the rtags interactive commands. For example:

M-x rtags-find-symbol