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

Re: Mac Questions

Expand Messages
  • 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 1 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 2 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 3 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 4 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 5 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 6 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.