Setting shell environment for Macports

Discussion in 'Mac Programming' started by acarro84, May 12, 2008.

  1. acarro84 macrumors newbie

    Joined:
    May 12, 2008
    #1
    Hi, I am new to the forums so this is my first post but i stumbled my way into some OSX development and now I am very interested to learn more. Here's my problem:


    I am trying to use my G15 keyboard on OSX the same way it works on windows and was led to this LINK to install macports. I'm totally new to MAC Dev so i am having problems with step 3. Also, if anyone else know how i can do this an easier way that would be appreciated.
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    Open the Terminal application and type in nano .profile then when you have added the relevant information type CTRL + o to save and then CTRL + x to quit. Then quit the Terminal application and you are all done with the .profile edits. Then just just type nano /path/to/file/name for any other files you need to edit. You may need to prepend sudo to that command if it says permission denied.
     
  3. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #3
    eh

    ok, my env looks like this:

    MANPATH=/usr/share/man:/usr/local/share/man:/usr/X11/man
    TERM_PROGRAM=Apple_Terminal
    TERM=xterm-color
    SHELL=/bin/bash
    TMPDIR=/var/folders/ry/ry7+EaELGcCwcGUkWnfX1E+++TI/-Tmp-/
    Apple_PubSub_Socket_Render=/tmp/launch-ZyJOn8/Render
    TERM_PROGRAM_VERSION=240
    USER=anthonycarro
    COMMAND_MODE=unix2003
    SSH_AUTH_SOCK=/tmp/launch-lGcqAy/Listeners
    __CF_USER_TEXT_ENCODING=0x1F5:0:0
    PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
    PWD=/Users/anthonycarro
    LANG=en_US.UTF-8
    SHLVL=1
    HOME=/Users/anthonycarro
    LOGNAME=anthonycarro
    DISPLAY=:0.0
    SECURITYSESSIONID=a31540
    _=/usr/bin/env

    which is not like the one in the installation guide for macports
     
  4. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #5
    next

    3. Compiling and installing g15tools

    First of all download source packages of libg15, libg15render, g15composer, g15daemon.
    3.1 Compiling and installing libg15
    $ ./configure --prefix=/opt/local CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib

    $ make

    $ sudo make install






    This is the part i am at now. When i do the first command that starts with ./configure i get a message tat says no such file or directory. I downloaded the lib15 source package and unzipped it. Should the folders be put somewhere specific?
     
  5. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #6
    Why are you compiling from source? You've just installed MacPorts so you don't have too. At the Terminal type port list g15 and then sudo port install *whatever the main package is called*. If you install from source you'll need to install the Developer tools on the Leopard DVD.

    Did you cd into the folder so that you are actually in the folder within the command line or did you just type that command in from a random location?
     
  6. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #7
    I had to install the developer tools already, tho I downloaded them (i think). I had to download and install xcode tools and x11SDK in order to install macports. I did not "cd" into the folder because I'm not sure what cd is although it makes sense so that it knows where to look. How do I cd into the folder that is on my desktop, called libg15-1.2.2 ?

    The link to the main page is HERE
    when i typed port list g15 nothing happened and the instructions that I am following don't say what the main package is.
     
  7. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #8
    In that case unzip all the files and the in Terminal type cd followed by one space (important) and then drag and drop the folder on the Terminal window. That should add the path. Press return in the Terminal window and type the commands as shown previously. Looks like you have no real need of MacPorts then if they don't have the packages. In fact there is no need for any of the prefix stuff on the ./configure command either - if you leave it out it'll just be installed in /usr/local instead.
     
  8. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #9
    ugh

    so macports is like a torrent tracker? It just lets you download files through the terminal? Everything that i have read so far says not to use the usr directory. I will try what you said and see what happens.
     
  9. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #10
  10. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #11
    No it just downloads an installer and automatically installs them. It has nothing to do with torrents.

    What are the problems you are having?
     
  11. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
  12. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #13
    Install it via MacPorts then. At least you have a use for it :).
     
  13. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #14
    ok

    I tried (after selfupdating) port wget http://people.roma2.infn.it/sestito/g15mac/g15daemon-1.2.7_OSX.patch

    said permission denied so i tried
    port sudo wget "URL"

    I got a few errors on that one:
    anthony-carros-macbook-pro:g15composer-3.1 anthonycarro$ sudo port wget http://people.roma2.infn.it/sestito/g15mac/g15daemon-1.2.7_OSX.patch
    Can't map the URL 'http://people.roma2.infn.it/sestito/g15mac/g15daemon-1.2.7_OSX.patch' to a port description file ("Port extract failed:
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error exit delayed from previous errors").
    Please verify that the directory and portfile syntax are correct.
    Error: Can't open URL 'http://people.roma2.infn.it/sestito/g15mac/g15daemon-1.2.7_OSX.patch' as a port
    Unrecognized action "wget"
     
  14. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #15
    Ah I see. MacPorts is not used to run commands.

    Type sudo port install wget. This will install wget, then you can run the command you showed above. Remember MacPorts is just an installer, you can't use it in the way you tried to above. sudo always comes first by the way in a specific command followed by the executable name (in this case port) then any arguments (in this case install wget).
     
  15. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #16

    Ok, I'm just going to fly to england and let you do this for me. Every step is not what are in the instructions. Or maybe I just don't know the context in which he is speaking. Next is:

    wget http://people.roma2.infn.it/sestito/g15mac/g15daemon-1.2.7_OSX.patch

    $ cd g15daemon-1.2.7

    $ patch -p1 < ../g15daemon-1.2.7_OSX.patch

    $ ./configure --prefix=/opt/local CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib

    $ make

    $ sudo make install


    says -bash: ../g15daemon-1.2.7_OSX.patch: No such file or directory

    I'm sure that is the file that was just downloaded in the wget above.

    this is what i got after the wget:

    anthony-carros-macbook-pro:~ anthonycarro$ wget http://people.roma2.infn.it/sestito/g15mac/g15daemon-1.2.7_OSX.patch
    --2008-05-12 18:53:47-- http://people.roma2.infn.it/sestito/g15mac/g15daemon-1.2.7_OSX.patch
    Resolving people.roma2.infn.it... 141.108.255.15
    Connecting to people.roma2.infn.it|141.108.255.15|:80... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: http://people.roma2.infn.it/~sestito/g15mac/g15daemon-1.2.7_OSX.patch [following]
    --2008-05-12 18:53:47-- http://people.roma2.infn.it/~sestito/g15mac/g15daemon-1.2.7_OSX.patch
    Reusing existing connection to people.roma2.infn.it:80.
    HTTP request sent, awaiting response... 200 OK
    Length: 2312 (2.3K) [text/plain]
    Saving to: `g15daemon-1.2.7_OSX.patch'

    100%[======================================>] 2,312 --.-K/s in 0.01s

    2008-05-12 18:53:47 (237 KB/s) - `g15daemon-1.2.7_OSX.patch' saved [2312/2312]
     
  16. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #17
    The folder should be in the same directory as the patch file. I assume the patch file is in /Users/*yourusername* so just move the folder there as well and do the cd (cd means change directory by the way) command that you typed above and then the patch command should work. If you ever need help on a Unix command just type man *command name*. For instance man cd or man patch.
     
  17. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #18
    nope

    found the file, its in my home directory like you said. When i type that second patch line however it keeps saying no such file or directory. I'm wondering if I should use a different -p# instead of 1. Maybe 0?
     
  18. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #19
    Did you cd into the directory and is the patch file in your home directory?
     
  19. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #20
    anthony-carros-macbook-pro:~ anthonycarro$ cd /Users/anthonycarro
    anthony-carros-macbook-pro:~ anthonycarro$ patch -p1 < ../g15daemon-1.2.7_OSX.patch-
    bash: /g15daemon-1.2.7_OSX.patch: No such file or directory


    sure enough, when i look in my user directory the patch file is in there. :confused:
     
  20. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #21
    Nah you need to do this command first:

    cd g15daemon-1.2.7
     
  21. acarro84 thread starter macrumors newbie

    Joined:
    May 12, 2008
    #22
    my next problem

    4. Codeless kext

    We have to load a codeless kext to prevent Apple's HID driver from claiming the device exclusively.

    This kernel extension is just a plist:
    <plist version="1.0">
    <dict>

    <key>CFBundleDevelopmentRegion</key> <string>English</string>
    <key>CFBundleGetInfoString</key> <string>Libusb USB device Shield</string>
    <key>CFBundleIdentifier</key> <string>com.libusb.USB_Shield</string>
    <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
    <key>CFBundleName</key> <string>Libusb USB device Shield</string>
    <key>CFBundlePackageType</key> <string>KEXT</string>
    <key>CFBundleSignature</key> <string>????</string>
    <key>CFBundleVersion</key> <string>6.0</string>
    <key>IOKitPersonalities</key>
    <dict>
    <key>Logitech G15</key>
    <dict>
    <key>CFBundleIdentifier</key>
    <string>com.apple.kernel.iokit</string>
    <key>IOClass</key>
    <string>IOService</string>
    <key>IOProbeScore</key>
    <integer>106000</integer>
    <key>IOProviderClass</key>
    <string>IOUSBInterface</string>
    <key>bConfigurationValue</key>
    <integer>1</integer>
    <key>bInterfaceNumber</key>
    <integer>0</integer>
    <key>bcdDevice</key>
    <integer>259</integer>
    <key>idProduct</key>
    <integer>49698</integer>
    <key>idVendor</key>
    <integer>1133</integer>
    </dict>
    </dict>
    <key>OSBundleCompatibleVersion</key> <string>1.8</string>
    <key>OSBundleLibraries</key>
    <dict>
    <key>com.apple.kernel.iokit</key> <string>6.0</string>
    </dict>
    </dict>
    </plist>
    Download and load the kext:

    $ wget http://people.roma2.infn.it/sestito/g15mac/libusbshield.kext.tar.gz

    $ tar xvfz libusbshield.kext.tar.gz

    $ sudo chmod -R root:wheel libusbshield.kext

    $ sudo cp -R libusbshield.kext /System/Library/Extensions



    I'm not sure if i have to do anything for the plist in the top of this step or if i just have to start with the download of the kext. I tried starting at the terminal commands and had a problem with the bold part.

    chmod: Invalid file mode: root:wheel

    is my message when i do that.
     

Share This Page