Launch UE from Terminal

Launch UE from Terminal

5
NewbieNewbie
5

    Jan 08, 2011#1

    I would like to be able to launch UE from the terminal windows. How do I set an alias so that I can invoke UE from a command line?

    Thanks,
    Rob

    341
    Basic UserBasic User
    341

      Jan 08, 2011#2

      Can you provide more information as to why you'd want to do this?
      Remember TERMINAL is a character based interface, and UltraEdit is a GUI

      5
      NewbieNewbie
      5

        Jan 08, 2011#3

        Dave -

        Thanks for your response. I am aware of the differences between terminal mode and GUI. I am in need to navigate via terminal to edit the configuration files for MySQL and PHP and other configuration type of files which are more easily navigated via terminal than through the finder. I would like to then invoke a command like, sudo UEM <filename> ; which would then invoke the UE editor with my text file ready for editing. I know this type of functionality is available with other editors and would like assistance in the proper way to implement for UEM.

        Rob

          Jan 08, 2011#4

          Here is what I have done to enable launching of UEM from the terminal.

          I edited .profile in my home directory and add the following line.

          alias uem="open -a /Applications/Ultraedit.app/Contents/MacOS/UltraEdit"

          This creates an alias of uem which launches the GUI editor.

          You can put the file after uem to have that file loaded for example, uem .profile, will open the .profile file in UEM.

          I hope this helps others out there for more info check out this link: http://osxdaily.com/2007/02/01/how-to-l ... -terminal/

          Rob

          6

            Jan 10, 2011#5

            One feature I miss from TextMate is the ability to open a list of files without loading any into the editor. For example, if I type "mate *" it basically creates a project on the fly containing everything in and below the current directory. This is much nicer than manually creating a project for the same files in UE.

            I don't understand the objection to launching UE from a terminal window. It's basically the only way I ever launch editors. The better command-line support UE and UC have the better, IMO. I can't wait for a UC port so I can use it as the default diff tool for SVN and other source-code management systems.

            5
            NewbieNewbie
            5

              Jan 11, 2011#6

              I use deltawalker on the Mac. I use UC on my PCs.

              3
              NewbieNewbie
              3

                Jan 19, 2011#7

                I'll use this until I find a way to see hidden files in the UE file open dialog. The only other way I've found is to set the environment so that no files are hidden. That is less satisfying than the method described here. Does anyone know a way to force UltraEdit to show hidden files?

                5

                  May 10, 2011#8

                  complexmath wrote:I don't understand the objection to launching UE from a terminal window. It's basically the only way I ever launch editors.
                  I just switched from PC to Mac. Primarily, I did so because I have become very familiar with Unix over the years, and OS X, being built on BSD, is also evolving to be more Unix-ish. (Oh, and Windows is evolving to be more LAME.)

                  Anyway, I think the objection stems from the classic Mac users, who fear using Terminal, and who resist the "PC-ification" of OS X, not realizing that it's actually a movement towards Unix/Linux. There is a growing trend of Linux types who are embracing Mac these days, and we're bringing our Shell along with a vengeance! I think the Mac landscape has room enough for both paradigms.

                  4
                  NewbieNewbie
                  4

                    Aug 15, 2012#9

                    There are at least a few ways of going about this. First is an alias, which has already been covered:

                    Code: Select all

                    alias ue='open -a UltraEdit.app '
                    The other trick is to make a link from somewhere in your path to the UltraEdit program inside the .app folder. This is what I did:

                    Code: Select all

                    sudo ln -s /Applications/UltraEdit.app/Contents/MacOS/UltraEdit /usr/local/bin/ultraedit
                    You'll want to specify a background process unless you want the terminal hanging. I've found it easier, typically, to use the alias.

                    1
                    NewbieNewbie
                    1

                      Oct 31, 2012#10

                      This is more a question about running a shell command from our compilers to call UEM. Getting UEM to load works as already described, but we always have to use the expanded name. If we use the command line as described for the Linux version, we get a new instance of UEM for each call. Is there a way to force a single instance?

                      Stephen

                      16
                      Basic UserBasic User
                      16

                        Dec 04, 2012#11

                        spelc wrote:... Is there a way to force a single instance?

                        Stephen
                        There is an option in preferences in the Windows version of UE. Evidently that option has not yet been ported.

                        You may want to send a note to UE support requesting that option to be ported sooner rather than later. :)

                        Travis

                        1
                        NewbieNewbie
                        1

                          Sep 12, 2013#12

                          With the latest UE for Mac, when you run "open" from command line in a terminal, it passes the arguments to the first instance of UE it finds running, or launches a new one:

                          Code: Select all

                          open -a /Applications/UltraEdit.app/Contents/MacOS/UltraEdit $* > /dev/null 2>&1 &
                          
                          If you make a soft link to the executable under /usr/local/bin, the 'open' looks like this

                          Code: Select all

                          sudo ln -s  /Applications/UltraEdit.app/Contents/MacOS/UltraEdit /usr/local/bin/ultraedit
                          
                          # then
                          
                          open -a  /usr/local/bin/ultraedit $* > /dev/null 2>&1 &
                          
                          # or $PATH contains /usr/local/bin
                          
                          open -a ultraedit $* > /dev/null 2>&1 &
                          
                          

                          1
                          NewbieNewbie
                          1

                            Mar 01, 2014#13

                            I created a bash function and put it in my ~/.bashrc to open UltraEdit from the command line:

                            Code: Select all

                            ue()
                            {
                               for FILE in "$@"; do
                                  if [ ! -e "$FILE" ]; then
                                    touch "$FILE"
                                  fi
                               done
                               open -a "UltraEdit" "$@"
                            }
                            
                            This will open a file or, if it doesn't exist, create a file and the open it i.e. ue filename

                            This also works for opening and creating multiple files i.e.
                            • ue *.txt
                            • ue filename1 filename2
                            • ue filetocreate1 /fullpath/and/filename2
                            I can't take the credit for this. I took the idea from iA Writer.