Home > Open Source > Installing gammu on Mac OS X

Installing gammu on Mac OS X

This mini tutorial will explain howto install gammu on Mac OS X, i’m using Mac OS X 10.5.8 and gammu 1.28.0.
To install gammu, you need cmake, and i’m using cmake 2.8.2, i installed it using Homebrew package manager.

To install Homebrew:

$ ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"

Then, you can install cmake with:

$ brew install cmake
Download gammu 1.28.0 here
Next, extract and install it:
$ ./configure
$ make
If you got errors like this:
Scanning dependencies of target array-test
[ 35%] Building C object tests/CMakeFiles/array-test.dir/array-test.o
Linking C executable array-test
[ 35%] Built target array-test
Scanning dependencies of target at-charset
[ 35%] Building C object tests/CMakeFiles/at-charset.dir/at-charset.o
Linking C executable at-charset
Undefined symbols:
“_iconv_open”, referenced from:
_IconvDecode in libGammu.a(coding.o)
_IconvEncode in libGammu.a(coding.o)
“_iconv_close”, referenced from:
_IconvDecode in libGammu.a(coding.o)
_IconvEncode in libGammu.a(coding.o)
“_iconv”, referenced from:
_IconvDecode in libGammu.a(coding.o)
_IconvEncode in libGammu.a(coding.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [tests/at-charset] Error 1
make[2]: *** [tests/CMakeFiles/at-charset.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
Then you’ve to configure cmake build to disable libiconv
$ mkdir build
$ cd build
$ cmake -DWITH_Iconv=OFF ..
$ make
$ sudo make install
Now, let’s connect the modem, i’m using Sierra USB Connect 881, and i got this information on /var/log/system.log:
Jul 16 22:34:10 macbooks-macbook kernel[0]: SierraSwitch: Version number – 1.2.1
Jul 16 22:34:10 macbooks-macbook kernel[0]: SierraSwitch: Driver Mode is 2 (Force Modem)
Jul 16 22:34:10 macbooks-macbook kernel[0]: SierraSwitch: Device version information for Mac OS:
Jul 16 22:34:10 macbooks-macbook kernel[0]: SierraSwitch: Revision = 0, SIPC = 24577(6001), SI Version = 1(1), CDPC = 0, CD Version = 0.0.0
Jul 16 22:34:10 macbooks-macbook kernel[0]: USBF:    41970.457    IOUSBInterface[0x418a700]::joinPMtree – could not find the hub device
Jul 16 22:34:13 macbooks-macbook kernel[0]: 0        0 SierraSupport: start – Default, suspend enabled for this device
Jul 16 22:34:13 macbooks-macbook kernel[0]: SierraSupport: Version number – 1.4.7, Input buffers 16, Output buffers 24
Unfortunately, it does not show where the modem attached on /dev/, because we need it to gammu configuration. So, i search it manually:
$ ls -la /dev | grep sierra
And it shows:
crw-rw-rw-   1 root   wheel      17,   9 Jul 16 22:34 cu.sierra001
crw-rw-rw-   1 root   wheel      17,  13 Jul 16 22:34 cu.sierra05
crw-rw-rw-   1 root   wheel      17,  11 Jul 16 22:34 cu.sierracntl
crw-rw-rw-   1 root   wheel      17,   8 Jul 16 22:34 tty.sierra001
crw-rw-rw-   1 root   wheel      17,  12 Jul 17 01:04 tty.sierra05
crw-rw-rw-   1 root   wheel      17,  10 Jul 17 01:04 tty.sierracntl
Now, let’s create gammu config:
$ cp /usr/local/share/doc/gammu/examples/config/gammurc ~/.gammurc
Mine is something like this:
[gammu]
device = /dev/tty.sierra05
connection = at115200
Finally, test the connection:
===============================
Add MySQL support
===============================
For example, i’ve smsdrc (gammu-smsd config file) like this:
[gammu]
device = /dev/tty.sierra05
connection = at115200
[smsd]
service = MYSQL
PIN = 1234
logfile = /Users/White/.smsdlog
debuglevel = 255
Then i run gammu-smsd and it throws error:
macbooks-macbook:~ White$ gammu-smsd -c /Users/White/.smsdrc
Log filename is “/Users/White/.smsdlog”
gammu-smsd[97218]: MYSQL service was not compiled in!
gammu-smsd[97218]: Failed to setup SMSD service: Desired functionality has been disabled on compile time. (DISABLED[62])
Failed to run SMSD: Desired functionality has been disabled on compile time.
gammu-smsd[97218]: MYSQL service was not compiled in!
It’s because gammu can’t find mysql header library when you compile it.
To add MySQL support to gammu-smsd you need mysql installed, for example i use xampp for Mac OS X, and i’m using 1.7.3 version. All you need to do is download and install the XAMPP itself and the Developer package, cause it contains the header library we need.
.
Now, let’s compile gammu with mysql support, extract gammu as usual, edit cmake/FindMySQL.cmake, add your XAMPP mysql path, it should be look like this:
find_program(MYSQL_CONFIG mysql_config
${MYSQL_CONFIG_PREFER_PATH}
/usr/local/mysql/bin/
/usr/local/bin/
/usr/bin/
/Applications/XAMPP/xamppfiles/bin/
)
Then, let’s configure cmake:
$ mkdir build
$ cd build
$ cmake -DMYSQL_LIBRARIES=/Applications/XAMPP/xamppfiles/lib/mysql/libmysqlclient_r.dylib ..
If everything OK, then it should be show something like this one:
– Configuring Gammu 1.28.0
– Could NOT find Doxygen  (missing:  DOXYGEN_EXECUTABLE)
– Using mysql-config: /Applications/XAMPP/xamppfiles/bin/mysql_config
– Found MySQL: /Applications/XAMPP/xamppfiles/include/mysql, /Applications/XAMPP/xamppfiles/lib/mysql/libmysqlclient_r.dylib
– Could not find PostgreSQL
Then make and make install:
$ make
$ sudo make install
Finally, run gammu-smsd again, if it doesn’t throw errors, then you’ve succeded, congrats :)
Have fun with gammu and gammu-smsd  :D
Categories: Open Source Tags: ,
  1. yoyo
    July 31, 2010 at 11:25 am | #1

    Hi, I have the problem similiar with you, my linux (open suse 11.0) can’t found MYSQL support during running ./configure. After that, I download libmysqlclient-dev but only improve in line “Using mysql-config: /usr/bin/mysql_config” but “MySql not found” still there. My question is, what is realy ./configure search in Mysql support file, because all of header file (*.h) from Mysql already in usr/include/mysql and library file also available in usr/lib/mysql (those both path writen in FimdMySql.cmake. Another question is your command “cmake -DMYSQL_LIBRARIES=/Applications/XAMPP/xamppfiles/lib/mysql/libmysqlclient_r.dylib ..” means that only dynamic library with name “xxx_r” will be linked an the others was not?
    Thanks

  2. August 2, 2010 at 6:13 pm | #2

    Hi

    The ./configure command is looking for the mysql.h file, located somewhere on your filesystem. Mine is on /Applications/XAMPP/xamppfiles/include/mysql.

    If you run mysql_config command, you’ll see where is your mysql working path.

    libmysqlclient is the dynamic/shared library that gammmu need to get Mysql support, i believe linux comes up with .so extension.

    I think you should try to build with custom cmake, not just ./configure, like i did on the post.

  3. August 4, 2010 at 2:42 am | #3

    Hi Azhari, I’m currently trying compile this at Mac too. Do we need XCode from Apple Development ? Because at my Mac OS (10.6.4) the latest one, after I brew install cmake, comment “Xcode is not installed! Builds may fail!”.
    Please advise dude

  4. August 4, 2010 at 8:49 am | #5

    no, this comment appeared when i try to run command ” brew install cmake”

  5. aaN
    August 5, 2010 at 4:50 am | #6

    gak paham deh klau pake Mac OS x :D

  6. September 29, 2010 at 6:59 pm | #7

    hello,
    i’ve the same problem with you, even though i’ve done configuring the FimdMySql.cmake just like you did, and also recompile gammu.
    any idea?
    mysql_config said that it is on /usr/bin/mysql_config
    thx

  7. September 30, 2010 at 5:23 pm | #8

    @mollie: Are you using xampp or mysql on Mac? All you need to do is find mysql.h header file, and libmysqlclient_r.dylib dynamic library to get gammu with mysql support.

  8. bakhtiar rifai
    December 31, 2010 at 11:06 pm | #9

    azhari, i can’t run $ cp /usr/local/share/doc/gammu/examples/config/gammurc ~/.gammurc
    notification : not such file or directory

    really need help.. please

    im using bandluxe modem n Xampp n osx 10.6.5

  9. January 1, 2011 at 2:31 am | #10

    @bakhtiar: Have you run the “make install” command? Otherwise, why not create it (gammurc) manually? it’s a sample config provided by gammu, you can create it by yourself.

  10. bakhtiar rifai
    January 2, 2011 at 3:30 am | #11

    Azhari Harahap :
    @bakhtiar: Have you run the “make install” command? Otherwise, why not create it (gammurc) manually? it’s a sample config provided by gammu, you can create it by yourself.

    im really n00b on this command line things, so where i have to place the gammurc file? coz, seem like my gammu was install on download folder..

  11. May 4, 2011 at 8:20 pm | #12

    hey, I have some error, after I type ./configure. I thought its because I dont have Cmake, but I already install it in may Mac. anybody know how to solve this error??

    Wrapper script for configuring CMake for Gammu.

    This provides limited compatibility with configure, if you want full
    configuration control, use directly CMake. More information about CMake
    is available at .

    CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_C_COMPILER_ENV_VAR
    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_C_COMPILER
    CMake Error: Could not find cmake module file:/Users/tr_mbil/Downloads/gammu-1.29.0/build-configure/CMakeFiles/CMakeCCompiler.cmake
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    – Configuring incomplete, errors occurred!

  12. May 5, 2011 at 6:29 am | #13

    @trimbil: it’s look like you missed the “make” command. You can install it from Developer Tools

  13. May 6, 2011 at 4:01 pm | #14

    Thank Azhari, I’m make it, but I have another issue. when I am trying to configuration my device with command : gammu-config, I got message:
    “You need dialog, cdialog or whiptail installed to make this work”
    ( I am using that command on my Ubuntu and that works but not in mac)

    I have trying to find dialog or cdialog or whiptail on google but I can’t found anygood source for my mac. Do you any solution for this.

    thanks for your answer.

  14. May 6, 2011 at 4:39 pm | #15

    @trimbil: gammu-config is just a tool to generate gammu configuration. You can just copy your gammu configuration from ubuntu to mac. Or you can create it manually, the configuration is not so hard. But, if you insist, try to install dialog from macports.

  15. May 7, 2011 at 9:34 am | #16

    Azhari Harahap :
    @trimbil: gammu-config is just a tool to generate gammu configuration. You can just copy your gammu configuration from ubuntu to mac. Or you can create it manually, the configuration is not so hard. But, if you insist, try to install dialog from macports.

    thanks for your answer, I got it now.
    have you ever succeed making a call from gammu?
    I am using gammu for sms gateway for long time ago but only for SMS gateway under windows but now I am trying to making call from gammu under linux and mac.
    maybe you have any suggestion or advice for me? literature or tutorial.
    thank in advance.

  16. May 8, 2011 at 4:26 pm | #17

    @trimbil: Never tried it out, but this link could help
    http://wammu.eu/docs/manual/gammu/index.html#call-commands

  17. May 9, 2011 at 3:00 pm | #18

    Sorry, but I am come back with another problem :D
    I am trying to connect ma nokia to the Mac and I am trying to identify the phone from system.log. but I just got this message from the system “May 9 16:57:21 remote191-125 pcscd[542]: Non-smartcard device launched pcscd [Vendor: 0X67B, Product: 0X2303]“.

    do you know how to solve this? bytheway I am using Nokia 3310.
    thank in advance

  18. May 10, 2011 at 3:32 am | #19

    @trimbil: Not sure, maybe the pcscd somehow messed up your system. Try to turn it off.

  19. May 17, 2011 at 11:03 am | #20

    Thanks kang, sukses dah walau sempet bingung.. ternyata folder /Applications/XAMPP/xamppfiles/include/mysql yg ga ada, solusinya install xampp-macosx-1.7.3-dev.dmg soalnya ane ga baca kalo ente bilang “All you need to do is download and install the XAMPP itself and the Developer package” :D

  20. dean
    May 21, 2011 at 12:26 am | #21

    nice to meet u’r blog.can i ask?
    how to configure gammu with mysql from macport?

  21. May 21, 2011 at 10:10 am | #22

    @dean: I’m not sure because never try it, but i believe all binary and library from macports located on /opt/local. All you have to do is looking all required library and path, then install it just like i showed on the post.

  22. Agung
    February 22, 2012 at 1:45 pm | #23

    Hi Azhary, i have an error like this after ” $ make ” from your instruction,

    Linking C executable smsd
    ld: warning: ignoring file /Applications/XAMPP/xamppfiles/lib/mysql/libmysqlclient.dylib, missing required architecture x86_64 in file
    Undefined symbols for architecture x86_64:
    “_mysql_close”, referenced from:
    _SMSDMySQL_Free in libgsmsd.a(mysql.o)
    _SMSDMySQL_Init in libgsmsd.a(mysql.o)

    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    make[3]: *** [tests/smsd] Error 1
    make[2]: *** [tests/CMakeFiles/smsd.dir/all] Error 2
    make[1]: *** [all] Error 2
    make: *** [all] Error 2

    can you figure it out?
    thanks

  23. February 22, 2012 at 4:52 pm | #24

    I’m not sure but it’s looks like arch issue, you might want to set specific arch when running cmake (http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_build_universal_binaries_on_Mac_OS_X.3F)

  24. nieldm
    April 1, 2012 at 7:26 pm | #25

    Hello there im trying to compile but throws me this error:

    [ 0%] Building C object helper/CMakeFiles/string.dir/string.o
    In file included from /Users/nieldm/Documents/Github/gammu/helper/string.c:1:
    /Users/nieldm/Documents/Github/gammu/helper/string.h:14:20: error: string.h: No such file or directory
    In file included from /Users/nieldm/Documents/Github/gammu/helper/string.c:1:
    /Users/nieldm/Documents/Github/gammu/helper/string.h:39: error: expected declaration specifiers or ‘…’ before ‘size_t’
    /Users/nieldm/Documents/Github/gammu/helper/string.h:39: warning: conflicting types for built-in function ‘strncasecmp’
    /Users/nieldm/Documents/Github/gammu/helper/string.h:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘towlower’
    In file included from /Users/nieldm/Documents/Github/gammu/helper/string.c:3:
    /Users/nieldm/Documents/Github/gammu/build/helper/../include/gammu-unicode.h:18:19: error: wchar.h: No such file or directory
    In file included from /Users/nieldm/Documents/Github/gammu/helper/string.c:3:
    /Users/nieldm/Documents/Github/gammu/build/helper/../include/gammu-unicode.h:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘UnicodeLength’
    /Users/nieldm/Documents/Github/gammu/build/helper/../include/gammu-unicode.h:102: error: expected declaration specifiers or ‘…’ before ‘wchar_t’
    /Users/nieldm/Documents/Github/gammu/build/helper/../include/gammu-unicode.h:109: error: expected declaration specifiers or ‘…’ before ‘size_t’
    /Users/nieldm/Documents/Github/gammu/build/helper/../include/gammu-unicode.h:116: error: expected declaration specifiers or ‘…’ before ‘size_t’
    /Users/nieldm/Documents/Github/gammu/build/helper/../include/gammu-unicode.h:164: error: expected declaration specifiers or ‘…’ before ‘wchar_t’
    /Users/nieldm/Documents/Github/gammu/build/helper/../include/gammu-unicode.h:169: error: expected ‘)’ before ‘value’
    /Users/nieldm/Documents/Github/gammu/helper/string.c:5:19: error: ctype.h: No such file or directory
    /Users/nieldm/Documents/Github/gammu/helper/string.c: In function ‘strcasestr’:
    /Users/nieldm/Documents/Github/gammu/helper/string.c:15: error: ‘size_t’ undeclared (first use in this function)
    /Users/nieldm/Documents/Github/gammu/helper/string.c:15: error: (Each undeclared identifier is reported only once
    /Users/nieldm/Documents/Github/gammu/helper/string.c:15: error: for each function it appears in.)
    /Users/nieldm/Documents/Github/gammu/helper/string.c:15: error: expected ‘;’ before ‘len’
    /Users/nieldm/Documents/Github/gammu/helper/string.c:19: error: ‘len’ undeclared (first use in this function)
    /Users/nieldm/Documents/Github/gammu/helper/string.c:19: warning: incompatible implicit declaration of built-in function ‘strlen’
    /Users/nieldm/Documents/Github/gammu/helper/string.c:23: error: ‘NULL’ undeclared (first use in this function)
    /Users/nieldm/Documents/Github/gammu/helper/string.c:25: error: too many arguments to function ‘strncasecmp’
    /Users/nieldm/Documents/Github/gammu/helper/string.c: In function ‘strchrnul’:
    /Users/nieldm/Documents/Github/gammu/helper/string.c:36: warning: incompatible implicit declaration of built-in function ‘strchr’
    /Users/nieldm/Documents/Github/gammu/helper/string.c:37: error: ‘NULL’ undeclared (first use in this function)
    /Users/nieldm/Documents/Github/gammu/helper/string.c:37: warning: incompatible implicit declaration of built-in function ‘strlen’
    /Users/nieldm/Documents/Github/gammu/helper/string.c: At top level:
    /Users/nieldm/Documents/Github/gammu/helper/string.c:49: error: expected declaration specifiers or ‘…’ before ‘size_t’
    /Users/nieldm/Documents/Github/gammu/helper/string.c: In function ‘strncasecmp’:
    /Users/nieldm/Documents/Github/gammu/helper/string.c:55: error: ‘n’ undeclared (first use in this function)
    /Users/nieldm/Documents/Github/gammu/helper/string.c: At top level:
    /Users/nieldm/Documents/Github/gammu/helper/string.c:107: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘towlower’
    make[2]: *** [helper/CMakeFiles/string.dir/string.o] Error 1
    make[1]: *** [helper/CMakeFiles/string.dir/all] Error 2
    make: *** [all] Error 2

    thanks

  25. April 2, 2012 at 6:19 am | #26

    Are you installing gammu from git repository? Please try the latest stable source instead.

  26. nieldm
    April 2, 2012 at 6:42 am | #27

    yes i just clone from this git repository

    git clone git://gitorious.org/gammu/mainline.git gammu

    I got that error running just

    ./configure
    make

    And we i follow the guide i get the same error using the cmake

    thanks

  27. April 2, 2012 at 3:12 pm | #28

    I suggest you to report to gammu mailing list (http://wammu.eu/support/lists/)

  1. July 27, 2010 at 5:07 pm | #1
  2. February 23, 2011 at 8:59 pm | #2
  3. February 24, 2011 at 1:33 pm | #3
  4. November 22, 2011 at 2:41 am | #4

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.