Frequently Asked Questions on Unix/Mac OS X
  1. How to intall a downloaded file for Ch in Mac OS X?
  2. How to run command/file in the current directory?
  3. How to get started in Mac OS X?
  4. How to make Ch run as the default shell in the Terminal app on the Mac?
  5. How to setup AquaTerm to display plots in Ch?
  6. How to run qanimate for using Ch Mechanism in Mac?
  7. How to set .ch file associations for ChIDE in Mac OS X?
  8. Why does the sigl demo give the error "dyld: Library not loaded: libchplot.dylib"?
  9. why I get the following error when doing plotting: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory?

Q: How to intall a downloaded file for Ch in Mac OS X?

If you downloaded a file for Ch, say chevaluation-6.0.0.macosx10.ppc.tar.gz for Ch Professional Evaluation Edition version 6.0.0, you can install it with the following steps.

  • Left click "Go" at the top menu, and then left click "Utilities" on the pull-down menu.
  • Under Utilities window, left double click "Terminal". A terminal will pop-up.
  • By default, the current directory of the terminal is /Users/your_account_home/Desktop. Assume you have downloaded the file chevaluation-6.0.0.macosx10.ppc.tar.gz on your desktop. Otherwise, you need to change to the directory where the downloaded file is located by typing the command 'cd' followed by the directory name such as 'cd /some/dir/name/for/your/downloaded/file'.
  • Type the following commands to install the software. gzip -cd chevaluation-6.1.0.macosx10.ppc.tar.gz | tar -xvof - cd chevaluation-6.1.0.macosx10.ppc sudo sh ./install.sh
  • For Ch Student Edition, the downloaded file name starts with chstudent instead of chevaluation. For Ch Standard Edition, the downloaded file name starts with chstandard instead of chevaluation. The version number 6.1.0 will be different if it is not version 6.1.0.

    Q: How to run command/file in the current directory?

    If you have a file named "foo.ch" in the current directory, run command "chmod 755 foo.ch" first if foo.ch is not an executable file.

    For security reason, by default, the current directory is not in the command path. There are two ways to run "foo.ch"

    • You may run the command using "./foo.ch"
    • Or you can add the current path in the command path first by running "ch -d", which will copy startup file ".chrc" to your home directory. Then, use an edit such as "vi" to edit ".chrc" in your home directory. Remove comment "//" from
      //_path = stradd(_path, ".;");
      Save ".chrc" and restart Ch by typing "ch".
      Now, you can run the command "foo.ch" in the current directory.
    Q: How to get started in Mac OS X?

    The use of Ch is similar to C-Shell, BASH or Perl in MacOSX.

    Getting started in Ch, you must start Unix terminal from the menu of Applications/Utitiles/Terminal, then type

               ch
               help
    
    For more information, please check Ch Installation Guide and Ch User's Guide.

    Q: How to make Ch run as the default shell in the Terminal app on the Mac?

    In the Terminal application:

    1. Go to the "Terminal/Preferences" menu
    2. Select the "Execute this command" button
    3. Enter "/bin/ch" as the command
    4. Close the preferences window
    
    Now any new shell (Apple-N) opened will be a Ch shell.
    To save the shell with all the preferences, select "File/Save", and will save it to "~/ Library/Application Support/Terminal" as a .term file.
    This can be opened from the "File" menu so all your prefs are as you saved them.

    Q: How to setup AquaTerm to display plots in Ch?

    Plots in Ch Professional Edition can be displayed using either X11 or AquaTerm.

    Plots in Ch are displayed using X11 by default. Installation instructions for X11 can be found by searching for "X11 install" on Xquartz's web site.

    AquaTerm is an open source application for Mac OS X that provides a GUI interface for plotting programs. To use AquaTerm for displaying plots in Ch, follow the instructions below to set it up.

    1. Downloaded AquaTerm from the internet at its Web site and install it.
    2. Create a system startup file .chrc in your home directory by command ch -d
    3. Add the statement putenv("GNUTERM=aqua"); inside the startup file .chrc in your home directory. A line may already exist and just need to be uncommented. If this is the case, just uncomment the line by getting rid of the "//" at the beginning of the line.

    Q: How to run qanimate for using Ch Mechanism in Mac?

    You need to install X11 from XQuartz first, then reboot your macosx to get it work.

    Otherwise, you will get the following error:

       dyld: Library not loaded: /usr/X11/lib/libXaw.7.dylib
       Referenced from: /usr/local/ch/sbin/qanimate
      

    Q: How to set .ch file associations for ChIDE in Mac OS X?

    When installing Ch Student or Ch Professional in Mac OS X, the file associations for ch file formats such as .ch will not be established automatically. This can be configured manually by performing the following steps:

     Control-click or right-click on the Ch file (.ch) and select Open With
    
     Click Other
    
     Navigate to the ChIDE launcher file and select it
    
     Check "Always Open With"
    
     Click Open
    
     This will launch ChIDE and open the Ch file.  The file association is also set for future use.  
    
    
    Q: Why does the sigl demo give the error "dyld: Library not loaded: libchplot.dylib"?

    If you run the softintegration graphical library in Mac and get the following error:

       dyld: Library not loaded: libchplot.dylib
    

    you need to set up the environment variable DYLD LIBRARY PATH. It shall include the path SILIB HOME/lib to load the library at runtime. The environment variable can be updated in a startup file under different Unix shells. Assume /usr/local/silib is the home for SILIB HOME, under a Ch shell, use the following code in its startup file .chrc in your home directory.

    if(getenv("DYLD_LIBRARY_PATH")!=NULL)
    putenv(stradd("DYLD_LIBRARY_PATH=/usr/local/silib/lib:",
    getenv("DYLD_LIBRARY_PATH")));
    else
    putenv("DYLD_LIBRARY_PATH=/usr/local/silib/lib");
    

    Under a .csh. or .tcsh. shell, use the following code.

    if ($?DYLD_LIBRARY_PATH) then
    setenv DYLD_LIBRARY_PATH /usr/local/silib/lib:${DYLD_LIBRARY_PATH}
    else
    setenv DYLD_LIBRARY_PATH /usr/local/silib/lib
    endif
    

    Under a .sh., .ksh., or .bash. shell, use the following code.

    if test "${DYLD_LIBRARY_PATH}" = ""
    then
    export DYLD_LIBRARY_PATH=/usr/local/silib/lib
    else
    export DYLD_LIBRARY_PATH=/usr/local/silib/lib:${DYLD_LIBRARY_PATH}
    fi
    
    Q: why I get the following error when doing plotting: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory?

    You need to make sure that gd and wxGTK libraries are installed. You can try the following solutions in Linux.

     yum install gd
     yum install wxGTK