Loading ...
Sorry, an error occurred while loading the content.

Re: Mac Questions

Expand Messages
  • Brett Calcott
    This does seem to be the case. No amount of fiddling with .profile .bashrc .bash_profile /etc/bashrc or whatever makes any difference to the environment that
    Message 1 of 9 , Jan 8, 2007
    • 0 Attachment
      This does seem to be the case. No amount of fiddling with .profile
      .bashrc .bash_profile /etc/bashrc or whatever makes any difference to
      the environment that ends up in the GUI version that is started from
      the dock.

      For the moment I just do something like this:
      if has("gui_running")
      let $PATH=$PATH.':/some/more/paths:/and/more/still'
      endif

      Which does the trick for now.

      >
      > PS: I cc'ed this to the Mac list as well.
      >
      >

      Thanks for that. I probably should have started there...

      Thanks for the replies.
      Brett
    • Dave Land
      Hello, ... I don t know if the Mac folks have filled you in, but apps launched from the Finder get their environment from the file ~/.MacOSX/
      Message 2 of 9 , Jan 8, 2007
      • 0 Attachment
        Hello,

        On Jan 8, 2007, at 2:31 PM, Brett Calcott wrote:

        > This does seem to be the case. No amount of fiddling with .profile
        > .bashrc .bash_profile /etc/bashrc or whatever makes any difference to
        > the environment that ends up in the GUI version that is started from
        > the dock.

        I don't know if the Mac folks have filled you in, but apps launched
        from the Finder get their environment from the file ~/.MacOSX/
        environment.plist. Mac OS X "Property List" files are XML, and they
        look like this (this is a bit of my own environment.plist):

        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
        www.apple.com/DTDs/PropertyList-1.0.dtd">
        <plist version="1.0">
        <dict>
        <key>myvimhelp</key>
        <string>~/.vim/doc/dml.txt</string>
        </dict>
        </plist>

        Th file contains any number of <key>/<string> pairs, which give the
        name and value of environment variables for Finder-launched apps.

        The values in environment.plist are loaded at login time, so you have
        to log out and back in for new variables to be available.

        Some folks keep all their environment variables in environment.plist
        and parse it from .bashrc (or equivalent for other shells) to load
        those vars into their shell. Happily, Apple provided a utility that
        handles it for you:

        defaults read "${HOME}/.MacOSX/environment"

        Also, with the Apple developer tools comes a program "Property List
        Editor" that makes it very easy to muck about with its contents. Of
        course, this being a vim list, most of you probably would prefer to
        use something like pico or emacs for this purpose :-).

        Dave
      • Dave Land
        ... Actually, making this work in bash (or other shell) requires a little more than just reading the file... Here s the relevant chunk from my .bashrc: # Get
        Message 3 of 9 , Jan 8, 2007
        • 0 Attachment
          On Jan 8, 2007, at 3:03 PM, Dave Land wrote:

          > Happily, Apple provided a utility that handles it for you:
          >
          > defaults read "${HOME}/.MacOSX/environment"

          Actually, making this work in bash (or other shell) requires a little
          more than just reading the file... Here's the relevant chunk from
          my .bashrc:

          # Get environment variables from ~/.MacOSX/environment.plist
          # (This avoids the sin of duplicating data here and in that file)
          if [[ `uname` == 'Darwin' ]] ; then
          defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
          awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
          $OneLine; done;
          fi

          To give credit where it's due, this came from a comment on
          macosxhints.com.

          The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
          same .bashrc across several hosts, including Solaris, Linux, and Mac
          OS X.

          Dave
        • Bram Moolenaar
          ... This issue comes up often enough that it deserves a section in the help. Could you perhaps write some text? If you can send me a patch that would be
          Message 4 of 9 , Jan 9, 2007
          • 0 Attachment
            Dave Land wrote:

            > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
            >
            > > Happily, Apple provided a utility that handles it for you:
            > >
            > > defaults read "${HOME}/.MacOSX/environment"
            >
            > Actually, making this work in bash (or other shell) requires a little
            > more than just reading the file... Here's the relevant chunk from
            > my .bashrc:
            >
            > # Get environment variables from ~/.MacOSX/environment.plist
            > # (This avoids the sin of duplicating data here and in that file)
            > if [[ `uname` == 'Darwin' ]] ; then
            > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
            > awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
            > $OneLine; done;
            > fi
            >
            > To give credit where it's due, this came from a comment on
            > macosxhints.com.
            >
            > The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
            > same .bashrc across several hosts, including Solaris, Linux, and Mac
            > OS X.

            This issue comes up often enough that it deserves a section in the help.
            Could you perhaps write some text? If you can send me a patch that
            would be great.

            --
            hundred-and-one symptoms of being an internet addict:
            4. Your eyeglasses have a web site burned in on them.

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ download, build and distribute -- http://www.A-A-P.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
          • Brian McKee
            ... Hash: SHA1 ... Just a quick note to anyone using that plist option - I once wasted about 20 hours of my time because a bad? corrupt? I never determined
            Message 5 of 9 , Jan 9, 2007
            • 0 Attachment
              -----BEGIN PGP SIGNED MESSAGE-----
              Hash: SHA1

              On 8-Jan-07, at 6:14 PM, Dave Land wrote:

              > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
              >
              >> Happily, Apple provided a utility that handles it for you:
              >>
              >> defaults read "${HOME}/.MacOSX/environment"
              >
              > Actually, making this work in bash (or other shell) requires a
              > little more than just reading the file... Here's the relevant chunk
              > from my .bashrc:
              >
              > # Get environment variables from ~/.MacOSX/environment.plist
              > # (This avoids the sin of duplicating data here and in that file)
              > if [[ `uname` == 'Darwin' ]] ; then
              > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"'
              > "'" | awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine;
              > do eval $OneLine; done;
              > fi
              >
              > To give credit where it's due, this came from a comment on
              > macosxhints.com.
              >
              > The conditional (if [[ `uname` == "Darwin' ]]) is because I use
              > this same .bashrc across several hosts, including Solaris, Linux,
              > and Mac OS X.

              Just a quick note to anyone using that plist option - I once wasted
              about 20 hours of my time because a 'bad? corrupt? I never determined
              exactly'
              enviroment.plist file caused my home folder to become read-only to
              the Finder! IIRC Terminal.app could still manipulate files.
              It caused all sorts of nifty issues (mainly because ~/Library is used
              so much). Since it's a single user machine, it looked like some
              bizarre disk issue.
              What really got me going was when I couldn't find the problem, I
              reinstalled from scratch, everything was fine, then it came back when
              I restored my home folder.
              Much hair tearing occurred on that one!

              Hopefully I can save a few follicles for somebody else.

              Brian
              -----BEGIN PGP SIGNATURE-----
              Version: GnuPG v1.4.6 (Darwin)
              Comment: Verify this email or encrypt your email for free - see gnupg.org

              iD8DBQFFo+f8GnOmb9xIQHQRAsbaAJ9GcS7DyjSU78O1v3YWxdgtoBReUgCgy8Aq
              HHLv34cFN6eyzje31pYIysk=
              =c/F5
              -----END PGP SIGNATURE-----
            • Brett Calcott
              Hi Dave, Thanks for that. I have spent about 15 years on Windows and know it well. Now I have the fun of discovering all the hidden bits on Mac. Thanks a lot!
              Message 6 of 9 , Jan 10, 2007
              • 0 Attachment
                Hi Dave,

                Thanks for that. I have spent about 15 years on Windows and know it well.
                Now I have the fun of discovering all the hidden bits on Mac.

                Thanks a lot!
                Brett

                On 1/9/07, Dave Land <land@...> wrote:
                >
                > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
                >
                > > Happily, Apple provided a utility that handles it for you:
                > >
                > > defaults read "${HOME}/.MacOSX/environment"
                >
                > Actually, making this work in bash (or other shell) requires a little
                > more than just reading the file... Here's the relevant chunk from
                > my .bashrc:
                >
                > # Get environment variables from ~/.MacOSX/environment.plist
                > # (This avoids the sin of duplicating data here and in that file)
                > if [[ `uname` == 'Darwin' ]] ; then
                > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
                > awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
                > $OneLine; done;
                > fi
                >
                > To give credit where it's due, this came from a comment on
                > macosxhints.com.
                >
                > The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
                > same .bashrc across several hosts, including Solaris, Linux, and Mac
                > OS X.
                >
                > Dave
                >
                >
              • Niklas Lindström
                Hi! Regarding getting your environment into a gvim session. I use the gvim.app which is used to launch multiple Vim.app:s, but with a modified script. ...
                Message 7 of 9 , Jan 11, 2007
                • 0 Attachment
                  Hi!

                  Regarding getting your environment into a gvim session.

                  I use the gvim.app which is used to launch multiple Vim.app:s, but
                  with a modified script.

                  I have simply replaced the content of "gvim.app/Contents/Resources/script" with:

                  ------------------------------ 8< ------------------------------
                  #!/bin/sh

                  PROFILE=~/.profile
                  if [ -e $PROFILE ]; then source $PROFILE; fi

                  VIM_APP_DIR=`echo $0 | sed 's#^\(.*\)gvim.app/Contents/Resources/script$#\1#'`

                  ${VIM_APP_DIR}/Vim.app/Contents/MacOS/Vim -go "$@" &
                  ------------------------------ >8 ------------------------------

                  Which gives me the same env-variables I have in my bash-sessions (and
                  also enables gvim.app and related to be put anywhere, not just
                  "/Applications").

                  Best regards,
                  Niklas
                • Benji Fisher
                  ... The docs already explain one way to set $PATH. ... As it says there, the system vimrc files in the versions distributed at macvim.org/OSX already use this
                  Message 8 of 9 , Feb 1, 2007
                  • 0 Attachment
                    On Tue, Jan 09, 2007 at 10:23:25AM +0100, Bram Moolenaar wrote:
                    >
                    > Dave Land wrote:
                    >
                    > > On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
                    > >
                    > > > Happily, Apple provided a utility that handles it for you:
                    > > >
                    > > > defaults read "${HOME}/.MacOSX/environment"
                    > >
                    > > Actually, making this work in bash (or other shell) requires a little
                    > > more than just reading the file... Here's the relevant chunk from
                    > > my .bashrc:
                    > >
                    > > # Get environment variables from ~/.MacOSX/environment.plist
                    > > # (This avoids the sin of duplicating data here and in that file)
                    > > if [[ `uname` == 'Darwin' ]] ; then
                    > > defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"' "'" |
                    > > awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine; do eval
                    > > $OneLine; done;
                    > > fi
                    > >
                    > > To give credit where it's due, this came from a comment on
                    > > macosxhints.com.
                    > >
                    > > The conditional (if [[ `uname` == "Darwin' ]]) is because I use this
                    > > same .bashrc across several hosts, including Solaris, Linux, and Mac
                    > > OS X.
                    >
                    > This issue comes up often enough that it deserves a section in the help.
                    > Could you perhaps write some text? If you can send me a patch that
                    > would be great.

                    The docs already explain one way to set $PATH.

                    :help mac-faq

                    As it says there, the system vimrc files in the versions distributed at
                    macvim.org/OSX already use this method. The same method should work for
                    other environment variables ... but AFAIK the only one that matters is
                    $PATH.

                    HTH --Benji Fisher
                  Your message has been successfully submitted and would be delivered to recipients shortly.