MP_EDITOR doesn't work
Ryan Schmidt
ryandesign at macports.org
Thu Apr 6 20:51:15 UTC 2017
> On Apr 5, 2017, at 20:32, Lenore Horner <LenoreHorner at sbcglobal.net> wrote:
>
>
>> On Apr 5, 2017, at 20:35, Ryan Schmidt <ryandesign at macports.org> wrote:
>>
>>
>>> On Apr 5, 2017, at 16:27, Lenore Horner <LenoreHorner at sbcglobal.net> wrote:
>>>
>>>
>>>> On Apr 5, 2017, at 16:12, Rainer Müller <raimue at macports.org> wrote:
>>>>
>>>> On 2017-04-05 21:54, db wrote:
>>>>> On 4 Apr 2017, at 11:21, db <iamsudo at gmail.com> wrote:
>>>>>> On 4 Apr 2017, at 11:18, Rainer Müller <raimue at macports.org> wrote:
>>>>>>> How did you test this? This works fine for me:
>>>>>>> $ export MP_EDITOR=less
>>>>>>> $ port edit zlib
>>>>>> export VISUAL=/opt/local/bin/vim works
>>>>>> export MP_EDITOR=/opt/local/bin/vim doesn't
>>>>>
>>>>> Could you please try it with an editor?
>>>>
>>>> It works for me. I cannot reproduce the problem you have.
>>>>
>>>> Rainer
>>>
>>> For me (MacOS 10.12.3, latest MacPorts, .profile as the relevant file to edit)
>>> $ export MP_EDITOR=/usr/bin/nano
>>> works. However, following https://guide.macports.org/chunked/installing.shell.html,
>>> $ export MP_EDITOR=/usr/bin/edit
>>> to use TextWrangler (yes, I have it installed) fails with “Error: unable to invoke editor /usr/bin/edit: couldn't execute "/usr/bin/edit": no such file or directory”. I tried
>>> $ export MP_EDITOR=/Applications/TextWrangler.app
>>> but that fails with “Error: unable to invoke editor /Applications/TextWrangler.app: couldn't execute "/Applications/TextWrangler.app": permission denied” when I do
>>> $ port edit texlive-xetex
>>> and puts me in vim if I prepend sudo to the command. (Oh, never mind. I forgot I had the app store version and never installed the command line tools. Now
>>> $ export MP_EDITOR=/usr/local/bin/edit
>>> (note the correction to https://guide.macports.org/chunked/installing.shell.html)
>>> works.)
>>>
>>> I haven’t installed any editors through macports so I can’t check the /opt path, but at least stuff in /usr works as expected. (And thanks to poking at this, I now know two things I didn’t know before I started down this rabbit hole.)
>>>
>>
>> Did you notice that as of El Capitan, OS X includes a feature called System Integrity Protection which prevents third parties from modifying the contents of system directories, such as /usr/bin, and for that reason the TextWrangler helpers are no longer installed to that location? They're now available inside the TextWrangler application bundle at /Applications/TextWrangler.app/Contents/Helpers/edit.
>>
>> `edit` also doesn't work like `vi` in its default mode, in that it does not wait for the document to be closed before exiting. This can be confusing for some tools that expect the editor to wait. On my system, I define the EDITOR variable like this in my bash startup script:
>>
>>
>> export EDITOR=editor.sh
>>
>>
>> And then editor.sh is a short shell script in a directory in my PATH which contains:
>>
>>
>> #!/bin/sh
>> /Applications/TextWrangler.app/Contents/Helpers/edit +1 --wait --resume "$@"
>>
>>
>> This tells TextWrangler to open, select the first line of the file, wait until the file is closed before exiting, and when exiting, return to the program that caused TextWrangler to open (e.g. Terminal).
>>
>>
> Curious. As I noted above, once I grabbed the command-line installer for TextWrangler, then /usr/local/bin/edit worked fine to start TextWrangler. As far as I can tell, the web page should be corrected to say that the location is /usr/local/bin/edit as I noted above.
I've updated the guide:
https://github.com/macports/macports-guide/commit/25cda8abe5b1f6b1d1fd3b6b137bd4899f5e641e
I changed the instructions to reference BBEdit instead of TextWrangler, because it appears that TextWrangler is being discontinued soon. (Instead, BBEdit can now run for free forever, with limited features that are comparable to those offered in TextWrangler.)
More information about the macports-users
mailing list