myspaghetti / macos-virtualbox

Push-button installer of macOS Catalina, Mojave, and High Sierra guests in Virtualbox on x86 CPUs for Windows, Linux, and macOS
GNU General Public License v2.0
13.5k stars 1.12k forks source link

bash 5.1: unexpected EOF while looking for matching ')' #472

Closed mziminski616 closed 3 years ago

mziminski616 commented 3 years ago

I'm very new to the world of MacOS on a VM. I'm currently running this on my custom built desktop running Virtualbox. In order to run the script, I had to upgrade to Bash 4.x using homebrew. When I execute the script I get:

bash: ./macos-guest-virtualbox.sh: line 689: unexpected EOF while looking for matching ')'

Error: Could not configure virtual machine "".
Please execute the stage configure_vm again before resuming the script as described in the documentation.

Can anyone help me with this?

Masamune3210 commented 3 years ago

the shell script seems to be busted from that error, try downloading it again, and make sure its not corrupted by anything

myspaghetti commented 3 years ago

Hi, thanks for the bug report. Would you mind executing the following and attaching the resulting debug.txt file here?

cp macos-guest-virtualbox.sh debug.txt

mziminski616 commented 3 years ago

Hi, thanks for the bug report. Would you mind executing the following and attaching the resulting debug.txt file here?

cp macos-guest-virtualbox.sh debug.txt

Thanks for getting back to me so quickly. Here's the debug file. debug.txt

You'll notice that I replaced the top line that contained the bash 3 shell with the updated version of bash from homebrew. I'm thinking that's the problem. But when I run the script as is (from a fresh download and no edits) on Catalina, I get

Please execute this script with Bash 4.3 or higher, or zsh 5.5 or higher.
macOS detected. Make sure the script is not executed with the default /bin/bash which is version 3. Explicitly type the executable path, for example for zsh:
    /path/to/5.5/zsh macos-guest-virtualbox.sh
myspaghetti commented 3 years ago

I can't reproduce the bug with bash 5.x, and I can't find bash 4.x on homebrew, how did you install it?

mziminski616 commented 3 years ago

It was an entire 2 hour process actually. When I first saw the error message about the incompatible bash version, I googled how to update bash on Mac. I found a result that said I could do it from homebrew with brew install bash but I first had to install homebrew from homebrew.sh. I ran into an error because of xcode command line tools that I needed to manually install from Apple's official developer website. Once all was said and done, I had homebrew installed and also the newer version of Bash. I'm not home right now so I can't take a screenshot of the version.

But how this all came to be is this: I wanted to build a Mac VM and I found a guide online to do that. But the VRAM is only 3mb instead of the 128mb that I gave virtualbox on my windows 10 host. Is this what your scrip is intended for? Or am I completely missing the mark? How would you recommend that I achieve the task of the Mac VM? I know that this is probably outside the scope of the script, but at this point, I'm not sure I did anything right.

myspaghetti commented 3 years ago

macOS reports the VRAM incorrectly. You can improve graphics performance by installing the VMWare Tools.

Back to the bug, I can reproduce it with bash version 5.1.8(1)-release (x86_64-apple-darwin17.7.0)

Possibly it's specific to this version of bash. Currently investigating.

myspaghetti commented 3 years ago

As a workaround you can run the script with zsh until someone figures out what's going on with bash 5.1.8

mziminski616 commented 3 years ago

Thanks for looking into this. Just one last question. How do I run it with zsh? I’m still very new to Unix command lines even though I was a cs major back in college.

myspaghetti commented 3 years ago

Install zsh version 5.5 or higher, then execute /usr/loca/bin/zsh -i macos-guest-virtualbox.sh

myspaghetti commented 3 years ago

Reproduced with bash 5.1.8(1)-release (x86_64-pc-linux-gnu)

myspaghetti commented 3 years ago

Reproduced with bash 5.1.0 though 5.1.8

myspaghetti commented 3 years ago

Workaround in version 0.98.9

I'm pretty sure this is a bash bug, both of these seem valid to me:

"$(command \
--option parameter )"
"$(
command \
--option parameter
)"
myspaghetti commented 3 years ago

Closing as non-script as this is likely not a bug with the script. Since the behavior is inconsistent with and without the -i option, I've filed an issue with bash