XVim icon indicating copy to clipboard operation
XVim copied to clipboard

Xcode8 GM version couldn't launch.

Open dabing1022 opened this issue 9 years ago • 29 comments

Hi, guys.

I followed the guide in README to install XVIM on Xcode8 GM version, after removing code singature from Xcode, I restarted my Xcode8, but it cann't lanuch, just showed in dock and then disppear.

Is there anyone who knows what has happened?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/37851476-xcode8-gm-version-couldn-t-launch?utm_campaign=plugin&utm_content=tracker%2F252770&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F252770&utm_medium=issues&utm_source=github).

dabing1022 avatar Sep 14 '16 01:09 dabing1022

I am having this problem as well.

(This is possibly a duplicate of or related to #987 and #978, but I don't have the console logs to back it up.)

scolby33 avatar Sep 14 '16 02:09 scolby33

I got this problem too.

mantislin avatar Sep 14 '16 07:09 mantislin

As a last resort, delete your XVim codebase folder, clone it again and run make form the clean copy.

Then restart your Mac and try opening Xcode (perhaps more than once).

ashchan avatar Sep 14 '16 08:09 ashchan

Is make supposed to be run as root?

I generally run as a limited user. Running just make fails:

cp: /Applications/Xcode.app/Contents/Developer/../MacOS/Xcode_orig: Permission denied
The original Xcode binary is backed up to /Applications/Xcode.app/Contents/Developer/../MacOS/Xcode_orig
reading infile: /Applications/Xcode.app/Contents/Developer/../MacOS/Xcode
    found LC_CODE_SIGNATURE
not a fat binary
/Applications/Xcode.app/Contents/Developer/../MacOS/Xcode: Permission denied
/bin/sh: line 1: 22688 Abort trap: 6           Tools/unsign/unsign ${xcode_path}/../MacOS/Xcode ${xcode_path}/../MacOS/Xcode
make: *** [code_unsign] Error 134

Switching to an administrative account and running make from there results in the same error.

Running sudo make as an administrator completes successfully, but ends up with Xcode closing as soon as it launches: screen shot 2016-09-14 at 02 10 10

Replacing the new Xcode with Xcode_orig fixes the problem.

Thanks for your attention to this!

scolby33 avatar Sep 14 '16 09:09 scolby33

@scolby33 what's mean that "Replacing the new Xcode with Xcode_orig fixes the problem"? How can I do?

gaoyuqiang avatar Sep 14 '16 09:09 gaoyuqiang

@scolby33 it shouldn't require sudo to install. Actually I believe if you run it with sudo it'd try to install to / folder.

As for the damaged Xcode error, restart your Mac and retry and see if it opens.

ashchan avatar Sep 14 '16 10:09 ashchan

Without sudo, it can't run the unsign portion of the make sequence. Should I try doing that separately and then manually running the build?

EDIT: Here's what I did.

su $administrative_user
cd `mktemp -d`
git clone https://github.com/XVimProject/XVim
cd Xvim
sudo make uuid code_unsign
exit  # back as my normal user
cd `mktemp -d`
git clone https://github.com/XVimProject/XVim
cd Xvim
xcodebuild -configuration Release

Then I rebooted. This results in a working Xcode with signature removed (I can tell because it prompts for Keychain access when it starts) and XVim installed in /Users/$me/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Xvim.xcplugin. Unfortunately, there's still no Vim functionality in Xcode, and the XVim menu item is not present in the Editor menu.

scolby33 avatar Sep 14 '16 19:09 scolby33

@gaoyuqiang check out content of /Applications/Xcode.app/Contents/MacOS. You should be able to find two files: Xcode and Xcode_orig. Replace Xcode with Xcode_orig. Remember to uninstall XVim via make uninstall beforehand. Solved the problem for me.

lynxknight avatar Sep 14 '16 19:09 lynxknight

I would take this with a grain of salt since using codesign could result in unintended consequences but...

I was able to install successfully on 3eb09a6ffa68 in Xcode 8.0 by following the install instructions. When you see the 'y/N option, instead of pressing y, just press enter. That should resolve the sudo problem that some have been reporting.

Restart Xcode. Although the 3rd party plugin confirmation did show up saying if I should use the plugin or not, it did not get loaded into the process (mmap failure, I think). Make sure you click the proper thing to load the bundle. You can verify that you clicked on the correct option by typing: defaults read com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-8.0

You should get something like:

{
    allowed =     {
        "net.JugglerShu.XVim" =         {
            version = 1;
        };
    };
    skipped =     {
    };
}

After that, the XVim will load initially but not be mmap'd into the Xcode process. You can verify yourself by trying to attaching LLDB to Xcode and then executing process load Path/To/XVim

You can get around this by removing code signature.

sudo codesign --remove-signature /Applications/Xcode.app/

Restart Xcode and your vim should be good to go. You can concretely verify a success by attaching LLDB to Xcode and typing image list XVim

Remember to make a copy of Xcode before trying this out since there could be unintended consequences to removing the Xcode signature.

DerekSelander avatar Sep 15 '16 01:09 DerekSelander

@DerekSelander it works fine to me!

yanyin1986 avatar Sep 15 '16 03:09 yanyin1986

@DerekSelander When I try the 'codesign' command I get an error after following these instructions:

$ sudo codesign --remove-signature /Applications/Xcode.app/ /Applications/Xcode.app/: invalid or unsupported format for signature

I'm running OS 10.11.6 El Capitan--any ideas as to why this could be failing?

Thank you!

jmaha avatar Sep 15 '16 05:09 jmaha

In response to my previous comment, though codesign didn't work for me, I was able to get XVim working on Xcode 8 (woohoo!).

I followed the instructions @DerekSelander posted above. However, instead of using the 'codesign' command, I used the 'unsign' tool included in the XVim package successfully.

So instead of the 'codesign' command, I used this from the XVim repo clone root: sudo ./Tools/unsign/unsign /Applications/Xcode.app/Contents/MacOS/Xcode /Applications/Xcode.app/Contents/MacOS/Xcode

After this, I am up and running.

jmaha avatar Sep 15 '16 06:09 jmaha

Sorry that too many problems happens with Xcode 8. I can't take enough time to investigate everything now. I'll remove the code sign part from Makefile if it causes too much problems.

JugglerShu avatar Sep 15 '16 09:09 JugglerShu

The downside to stripping the signature is that playgrounds no longer work.

squarefrog avatar Sep 15 '16 15:09 squarefrog

@squarefrog interesting... playgrounds work for me when running Sierra beta while stripping the signature. I think going forward so @JugglerShu doesn't go insane we should give our macOS version with our issues/successes. After 9/20's release I think a lot of these issues about success and failures will become a lot clearer as the group migrates to Sierra

DerekSelander avatar Sep 15 '16 15:09 DerekSelander

Could be - I'm still on el cap.

I did copy the App Store Xcode and loading that up worked, albeit without xvim. Not a massive deal!

squarefrog avatar Sep 15 '16 16:09 squarefrog

@squarefrog Weird, I'm on El Cap and playgrounds are working fine for me with the stripped signature with the method I used above.

Also, thanks to @JugglerShu -- it's not easy keeping a project like this working across many versions of dev tools, and XVim is an absolute must-have for me. When it wasn't working in Xcode 8 I just stared dumbly at the screen for a few minutes mashing at my vim keystrokes to no avail. 😄 Thank you for creating and maintaining this fantastic tool!

jmaha avatar Sep 15 '16 17:09 jmaha

I want to piggy back onto what @jmaha said for @JugglerShu : Thanks so much for maintaining thing and all the hard work you put it. Xvim is my one and only MUST-HAVE. I live and die by vim and without Xvim, Xcode is so gross for me. Hopefully everything gets resolved without weird code-signing issues. I'm waiting a week or two before I update everything and am hoping some easily reproducible solutions will have been found.

Once again, thanks brotato chip!

adudenamedruby avatar Sep 15 '16 17:09 adudenamedruby

@DerekSelander pressing enter instead of y ends with:

Check dependencies
2016-09-16 09:09:11.200 xcodebuild[586:34066]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-11204/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/DependencyGraph/XCDependencyGraph.mm:688
Details:  unable to write dependency graph: You don’t have permission to save the file “XVim.build” in the folder “Release”.

It's followed by failed writing of auxiliary files (permission denied).

popizdeh avatar Sep 15 '16 23:09 popizdeh

I solved this by removing the code_unsign step in the makefile and self-signing Xcode:

sudo codesign -f -s <your_identity> /Applications/Xcode.app

I should note that self-signing took around 15-20mins to run. As far as I can tell XVim seems to mostly work in Xcode 8 (8A218a).

jackpooley avatar Sep 16 '16 09:09 jackpooley

@DerekSelander forgive me for the newbish question but...how does one attach LLDB to Xcode? It seems one has to go through an awful lot of trouble just to get the plugin to work with Xcode 8.

Jamongkad avatar Sep 20 '16 01:09 Jamongkad

@Jamongkad LLDB is not needed for any part of getting the plugin to work. However, it's a great tool to understand if the XVim plugin (or others) have been successfully loaded into Xcode. In addition, it's great to see if certain procedures will work by manually loading plugins through the debugger and seeing what fails now that Apple has upped the ante.

To answer your question, you need to disable rootless so you can attach to any process... Google that for exact instructions. Once rootless is disabled, in Terminal:

lldb -n Xcode

DerekSelander avatar Sep 20 '16 02:09 DerekSelander

Thank you! I got everything working finally.

Jamongkad avatar Sep 20 '16 14:09 Jamongkad

I added INSTALL_Xcode8.md which should work for everyone.

If you have any problem, report it here please.

JugglerShu avatar Sep 20 '16 22:09 JugglerShu

ありがとうございまーす👍!

ashchan avatar Sep 20 '16 22:09 ashchan

Still no luck, I did what INSTALL_Xcode8 says (btw it's 'codesign' not 'codesigner') and this is what I get:

make[1]: 'unsign' is up to date.
cp: /Applications/Xcode.app/Contents/Developer/../MacOS/Xcode_orig: Permission denied
The original Xcode binary is backed up to /Applications/Xcode.app/Contents/Developer/../MacOS/Xcode_orig
reading infile: /Applications/Xcode.app/Contents/Developer/../MacOS/Xcode
    found LC_CODE_SIGNATURE
not a fat binary
/Applications/Xcode.app/Contents/Developer/../MacOS/Xcode: Permission denied
/bin/sh: line 1: 42982 Abort trap: 6           Tools/unsign/unsign ${xcode_path}/../MacOS/Xcode ${xcode_path}/../MacOS/Xcode
make: *** [code_unsign] Error 134

popizdeh avatar Sep 20 '16 22:09 popizdeh

@popizdeh Get the latest Makefile. And also copy your Xcode_orig to Xcode. (Xcode_orig is back up of the original Xcode binary). It should be like

$ sudo cp /Applications/Xcode.app/Contents/MacOS/Xcode_orig /Applications/Xcode.app/Contents/MacOS/Xcode

Then follow the instruction in INSTALL_Xcode8 and make with updated Makefile.

JugglerShu avatar Sep 20 '16 22:09 JugglerShu

@popizdeh It seems I didn't push my commits to master (which makes fix to Makefile). I have just merged it so please get the latest master now and use the Makefile there.

JugglerShu avatar Sep 21 '16 22:09 JugglerShu

I have it running now, phew :) thanks

I had to remove my build directory because initially I ran make using sudo and root owned the directory which caused errors.

I also had to run unsign manually as @jmaha

popizdeh avatar Sep 21 '16 22:09 popizdeh