I am trying to make an executable link in an email for mac, so I don't want it to be a .exe file. I tried using a .command file so that it will run when you click on it, but it said it's from an unidentified developer and I don't want the recipient to have to change their security settings. So I want to use a .tar.gz file that has a shell script in it.
The problem is that when you click the link, it downloads but doesn't automatically run the shell script. I need to know when the file is unzipped so I can run the shell script inside. Does anyone know how to do that?
It isn't reasonable to expect to be able to run an arbitrary script on user's machine, without him explicitly asking to run it (e.g. if all he's doing is downloading a file, or opening a non-executable file).
If the OS allowed that, it would be a serious security breach.
Related
I used Packages to create a.pkg installer for a Mac OS X LaunchDaemon.
During install, I would like the user to be able to provide a few values for the configuration file. The resulting file is a simple text configuration file which will be sourced by a shell script when it is run.
Is there some tool that would make it easy to create a fill-in form with a few text fields? This would be presented to the user during install, and then save the values provided (or make them available to a postinstall shell script).
If there is no such tool, I guess I could do it with the shell and a few reads in a Terminal. But in that case, how to start that interactive shell script from my postinstall script?
Not sure, you can do it with the Distribution.dist XML file. It is JavaScript, but I have not looked though the definitions, since it comes out all garbled on my current version of Safari.
The easiest would be to create a small applications dialog run from the script, which you have full control over.
I have an executable terminal program (built on MacOS from Haskell code with GHC) which runs when I double-click it in the Finder. I want to put this on my website, from which people can download and run it from their Finder by double-clicking.
Somehow in this exchange the file loses the "+x" bit so that when it's re-downloaded it can't be run by double-clicking anymore. I can still run it but I have to do "chmod +x" first. What can I do so that the downloaded file will be executable by default? Do I have to package it inside a ".app" file? Right now it's ".command".
Regardless of whether it's part of an app bundle, the executable itself needs to be… executable. To ensure executability, you should put it in a zip or dmg file, which will preserve its 'executable' flag.
If you want to make it into an app bundle, there's a simple way to do that. If the executable is named PROGRAMNAME, then just put it in a folder called PROGRAMNAME.app. Double-clicking should run the file.
If you want to create a more proper app bundle, use this:
APP_NAME='My Awesome App.app'
EXE_NAME='PROGRAMNAME'
mkdir -p "$APP_NAME"/Contents
defaults write "`pwd`"/"$APP_NAME"/Contents/Info CFBundleExecutable "$EXE_NAME"
mkdir "$APP_NAME"/Contents/MacOS
cp "$EXE_NAME" "$APP_NAME"/Contents/MacOS
chmod a+x "$APP_NAME"/Contents/MacOS/"$EXE_NAME"
App bundles will not display Terminal output or report errors, so if you need that you should keep it as a raw executable. Also, simple apps made in the above manner will not have a GUI and will appear to not respond and will exit when they finish running.
Also, if you get the following message, it might be because the executable is too short (add more characters to it) or because of quarantining restrictions (try editing the executable and save it with an app like TextEdit to make it trusted).
I'm trying to set up Jenkins for continuous integration.
At the moment, I'm trying to do something very simple but am running into issues and I'm not sure if I'm doing something wrong or what I'm trying to do just isn't possible.
I currently have a file, which shows up on PC as a Windows batch file and on Mac as a Unix executable file. I run it from Mac and it uses xcodebuild and xcrun to make and share archives.
What I want to do for now is just have Jenkins do this for me (I'll add more stuff later) so I add added a build step and typed in the path to the batch file:
users/mcbuild/documents/work/fts/ArchiveFTS.bat
However, when I click build I get this:
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/jobs/FTS Build/workspace
[workspace] $ cmd /c call /var/folders/2n/gysykb914qlgtg2b0flhvh4r00007c/T/hudson6994878138376885970.bat
FATAL: command execution failed
java.io.IOException: Cannot run program "cmd" (in directory "/Users/Shared/Jenkins/Home/jobs/FTS Build/workspace"): error=2, No such file or directory
From searching around, I found a couple of possible solutions:
Had to specify the shell to C\windows\system32\cmd.exe
I'm not sure what this means or how to do this, can someone explain this please?
I'm not sure but doesn't it look like Hudson is trying to execute a .bat script on a Unix system?
Does that mean what I'm trying to do isn't possible and if not, what are my options please?
Some suggestions involve checking which user you're using Hudson as and maybe changing that
I'm not sure what user I am using it as or why it comes up as anonymous
Is there an issue with it being anonymous and if so, how do I change it please?
Thanks in advance for your help. If you need any more information please let me know.
It appears that you added a build step of type "Execute Windows batch command", but you are running this job on a Mac. What you need to do is run your xcode/xcrun file from an "Execute shell" build step. If you still have problems, make sure you can manually run the same file from a command prompt on the Mac (not by clicking on it). If you get an error about "Cannot run program sh", you may need to configure the path to sh. Type "which sh" at a command prompt to find out where sh is located. Click on Manage Jenkins, then Configure System, and enter the path under Shell Executable.
My application runs fine on my system, and also on several others.
However, some people can't run the application because the file in /Contents/MacOS/ApplicationName is not a Unix executable file.
Inputting the following line in the terminal forces the application to be executable, and solves the problem:
chmod +x ApplicationName
Obviously this is a very hacky way around the problem, and I don't want to tell users to enter chmod to run my application. What am I doing wrong? Why is it appearing as a Unix executable file on some systems, but not others? It could be a permissions issue...
at the moment, i transfer the app via dropbox to a client
Dropbox has problems with OS X metadata and permissions. Archive the application first (from the Finder context menu) and put the zip file into Dropbox.
I am distributing a Java program where I want a double-clickable file to run
java -cp MyProgram.jar;MyLib.jar my.program.Main
On Windows I simply distribute a .bat file, for *nix an executable .sh file. Problem is, double-clicking the .sh file just opens it up in a text editor on Mac. What should I do for Mac?
On mac, there is a specific extension for executing shell scripts by double clicking them: this is .command.
For Java applications on Mac, you really should use Apple's Jar Bundler (in the Developer Tools/Applications/Utilities folder; really a symlink to /usr/share/java/Tools/Jar Bundler). It lets you make a proper OS X double-clickable app, including setting preferences for e.g. using the Mac toolbar, JVM version, graphics system, OS X app metadata and classpath/resources.
You can use a .sh (Shell Script), after all MacOSX is Unix!
The answer about using the Jar Bundler tool is correct, but if you want to use a .sh file, make sure the unix permissions are set properly to something like 755 with CHMOD, and make sure the first line contains the path to a shell installed by default on Mac OS X. Also note that even with the +x bit set, it may still ask the user whether they want to open it or run it.