Stuck at ".android/repositories.cfg could not be loaded." - macos

brew cask install android-sdk
==> Caveats We will install android-sdk-tools, platform-tools, and build-tools for you. You can control android sdk packages via the
sdkmanager command. You may want to add to your profile: 'export
ANDROID_HOME=/usr/local/share/android-sdk'
This operation may take up to 10 minutes depending on your internet
connection. Please, be patient.
==> Downloading https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip
Already downloaded:
/Users/ishandutta2007/Library/Caches/Homebrew/Cask/android-sdk--25.2.3.zip
==> Verifying checksum for Cask android-sdk
==> Warning: File /Users/ishandutta2007/.android/repositories.cfg could not be loaded.

Create the file! try:
mkdir -p .android && touch ~/.android/repositories.cfg

Actually, after waiting some time it eventually goes beyond that step.
Even with --verbose, you won't have any information that it computes anything, but it does.
Patience is the key :)
PS : For anyone that cancelled at that step, if you try to reinstall the android-sdk package, it will complain that Error: No such file or directory - /usr/local/share/android-sdk.
You can just touch /usr/local/share/android-sdk to get rid of that error and go on with the reinstall.

This happened on Windows 10 as well. I resolved it by creating an empty repositories.cfg file.

For Windows 7 and above go to C:\Users\USERNAME\.android folder and follow below steps:
Right click > create a new txt file with name repositories.txt
Open the file and go to File > Save As.. > select Save as type: All Files
Rename repositories.txt to repositories.cfg

Creating a dummy blank repositories.cfg works on Windows 7 as well. After waiting for a couple of minutes the installation finishes and you get the message on your cmd window -- done

Windows 10 Solution:
For me this issue was due to downloading and creating an AVD using Android Studio and then trying to use that virtual device with the Ionic command line.
I resolved this by deleting all existing emulators and creating a new one from the command line.
(the avdmanager file typically lives in C:\Users\\Android\sdk\tools\bin)
List existing emulators:
avdmanager list avd
Delete an existing emulator:
avdmanager delete avd -n emulator_name
Add system image:
sdkmanager "system-images;android-24;default;x86_64"
Create new emulator:
sdkmanager "system-images;android-27;google_apis_playstore;x86"

I had the same error on OSX Sierra, but in my case the ~/.android folder was owned by root (from a previous install)
I changed the ownership to my User and now it works.

I used mkdir -p /root/.android && touch /root/.android/repositories.cfg to make it works

Related

XAMPP doesn't work after update to macOS Big Sur

Today I updated my mac to macOS Big Sur and I can't open XAMPP. When I click on app it doesn't give any response.
Do you know how solve this problem?
You can do a clean installation, but you will lose all your old files and databases. I suggest making a backup of this data.
Uninstall old versions of xampp.
Installation of Xampp by the brew
brew install --cask xampp
If you don't have the brew installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
HomeBrew
After Big Sur installation if XAMPP is not opening, get newest version of XAMPP (7.4.12) from their web site.
If you end up with error "Error starting “XAMPP” stack: cannot calculate MAC address: signal killed". After installing the latest version, do following:
Go to terminal ->
cd ~/.bitnami/stackman/helpers
Mv hyperkit hyperkit_backup
After that XAMPP opens and tells its the first time opening, but at least I found all the files etc as before Big Sur upgrade.
Install XAMPP 7.4.12, works perfectly in MacOS Big Sur
I had Xampp 7.4.9 and update Mac OS to Big Sur. Xampp didn't want to launch after that. I lost access to all my projects inside of /htdocs folder hidden somewhere in path structure of my virtual machine.
Kindly note I used version 7.4.9-VM (not 7.4.9-Installer) that is why all my files blocked inside of
/Users/'your_user_name'/.bitnami/stackman/machines/xampp/vm/machine.qcow2
Actually all files are important here:
/Users/'your_user_name'/.bitnami/stackman/machines/xampp
not only machine.qcow2
My solution is kind a mix of before mentioned solutions because they didn’t help in full.
First of all make a backup - copy old structure (with blocked files) to some directory - all this structure:
/Users/'your_user_name'/.bitnami/stackman/machines/xampp
(To see hidden files in MacOS use [Command]+[Shift]+[.])
You also can just rename
/Users/'your_user_name'/.bitnami/
to something like
/Users/'your_user_name'/.my_blocked_files_bitnami/
As programmers here advised to install 7.4.12-VM I installed this version. Very important to install "Virtual Machine" version (as you can see there are 2 installers for each version of Xampp)
Right after I launched 7.4.12-VM the new directory was created here:
/Users/'your_user_name'/.bitnami/
and Xampp will work properly but with no your old projects.
Do not do this step: As programmers here advised to change only one file
/Users/'your_user_name'/.bitnami/stackman/machines/xampp/vm/machine.qcow2
for me it was not enough - Xampp failed with an error:
ERROR: Error starting "XAMPP" stack: cannot start stack: ssh not accessible
My solution was put whole structure from folder xampp
/Users/'your_user_name'/.my_blocked_files_bitnami/stackman/machines/xampp
to here:
/Users/'your_user_name'/.bitnami/stackman/machines/xampp
You may before rename your current folder
/Users/'your_user_name'/.bitnami/stackman/machines/xampp
to something like
/Users/'your_user_name'/.bitnami/stackman/machines/new_xampp_without_my_projects
Then launch Xampp (Xampp should say something about incopatible versions but allows to continue), start all services, mount the disk. press "Expore" and you should see all your old projects.
Thank you.
You can solve this problem by updating xampp ver 7.2.34 .
https://www.apachefriends.org/download.html
Same thing happened to me but the version 7.4.12 seems to be working. I download it from the link I'll but below. I've been reading and the problem seems to be that Big Sur changes some paths that are set by default and so the apps won't launch. Same thing happened to Apache NetBeans.
XAMPP Download Link:
(https://sourceforge.net/projects/xampp/files/XAMPP%20Mac%20OS%20X/7.4.12/)
I had the same problem. This is how I solved it:
First, be sure that you back up your files in XAMPP VM. Your files are in
/Users/'your_user_name'/.bitnami/stackman/machines/xampp/vm/machine.qcow2
Then you can reinstall XAMPP again. I have installed 7.4.12 and it worked fine.
If you see stack error message, this is what you have to do:
Close XAMPP
Open a terminal and remove the stack folder with the following code:
rm -rf ~/.bitnami/stackman
Open XAMPP and check if a new stackman folder is created.
/Users/'your_user_name'/.bitnami/stackman/
If it does not, then start XAPP and stop again. When the stackman folder is created, override the file below with your backup file.
/Users/'your_user_name'/.bitnami/stackman/machines/xampp/vm/machine.qcow2
Close XAMPP again and restart again.
Voila! Here are your files...
I tried reinstalling XAMPP on MACos Big Sur, and it worked. However, my files are not recovered.
you can type this code in terminal
before this code you should close xampp
rm -rf ~/.bitnami/stackman
if you are getting error message saying:
Cannot calculate MAC Address: Using fd 10 for I/O notifications hv_vm_create HV_ERROR (unspecified error)
you need to download new hyperkit from bitnami and replace the current one
cd /tmp
curl -LJO "https://downloads.bitnami.com/files/hyperkit/hyperkit-testing-`20210430"`
mv /tmp/hyperkit-testing-20210430 ~/.bitnami/stackman/helpers/hyperkit
chmod +x ~/.bitnami/stackman/helpers/hyperkit
read tutorial here:
https://floyk.com/en/post/xampp-doesnt-work-after-update-to-macos-big-sur

Is gvfs-trash installed? in Atom

When I tried to remove a file in local machine to check files are synchronous with vagrant development server it pops up an error:
The following file couldn't be moved to the trash.
Is gvfs-trash installed?
For solving it I created a trash directory that can be accessed from outside the user’s home directory:
# Create a Trash directory (with some subdirectories) in root
sudo mkdir -p /.Trash-1000/{expunged,files,info}
# Give ownership of this to your user:
sudo chown -R $USER /.Trash-1000
Still I can't remove the file from local machine. But If I delete a file at vagrant development server it automatically deletes at local machine, opposite is not happening and ends-up with this error "Is gvfs-trash installed? "
Like YuriAFGomes said, everything seemed to work fine in my system: trash folder had the right permissions and gvfs-trash worked flawlessly from command line, yet atom 1.45 said it couldn't delete any file. Tried to start atom with sudo and it didn't fix anything. Tried creating the .Trash-1000 directories in several places, and nothing, same error related to gvfs-trash. I'm pretty sure this used to work fine in my atom setup and suddenly it stopped doing so, and I have no idea why. I went to their releases list and tried downgrading to several of them until I settled with version 1.30, which doesn't seem to have this issue and is compatibles with my local packages. If you have this problem and tried everything said around the web, I suggest you try downgrading to different versions until the problem goes away.
There is an issue on GitHub reporting this problem. According to the report, a missing .Trash-1000 can cause this problem, so you can create it as follows.
mnt=/; id=$(id -u); sudo mkdir -p "$mnt/.Trash-$id"/{expunged,files,info} \
&& sudo chown -R $USER:$USER "$mnt/.Trash-$id"/ \
&& sudo chmod -R o-rwx "$mnt/.Trash-$id"/
Set mnt to the mount point, where gvfs-trash is expecting it.
Simply cd to the directory which will be opened in atom and execute df ..
This will give something like this:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 960380628 463122460 448403708 51% /mnt/vol
In this example, the mount point and the value of mnt would be /mnt/vol.
What solved this issue for me was uninstalling atom via dpkg and installing it via apt from the following PPA: https://launchpad.net/~webupd8team/+archive/ubuntu/atom . I have no clue why this works, though. I have noticed that the PPA installs atom 1.26, while the version where the issue arised, installed via dpkg, is 1.45.
Before doing that, I have tried creating the .Trash-1000 directories in root, in home and in project folder, with the proper permissions. gvfs-trash was installed, updated and working as expected all the time, but the problem persisted. Really odd.
The real problem is that atom/electron are/were using gvfs-trash which has been deprecated for almost 5 years. Electron which is the platform on which Atom is built has fixed this in the development branch but hasn't backported it to the 2.0 branch on which Atom is based.
Solution/Workaround as of now?
Use an environment variable $ELECTRON_TRASH and set it to gio or one of the alternatives
See if you are missing the .Trash-1000 folder (assuming your uid is 1000)
Install an alternate gvfs-trash script to take over the missing functionality
Delete the file/folder outside of atom
I had a similar problem on Windows using Atom, where I couldnt delete the files. So I resorted to deleting them manually from the directory (outside of Atom).
Turns out atom cannot "move to trash" if u checked in recycle bin this option:
"Don't move files to the Recycle Bin. Remove files immediately when deleted."
Just set the other option (to move files to actual recycle bin) and should work.

Why "Watchman crawl failed" error in react-native immediately after updating to macOS catalina?

Trying to run react-native run-ios or build RN project from xcode, as soon as metro bundler starts, this error appears in the terminal:
Loading dependency graph...jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: resolve_projpath: path `/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA`: open: /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
events.js:183
throw er; // Unhandled 'error' event
^
Error: resolve_projpath: path `/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA`: open: /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA: Operation not permitted
at BunserBuf.<anonymous> (/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA/node_modules/fb-watchman/index.js:95:23)
at emitOne (events.js:116:13)
at BunserBuf.emit (events.js:211:7)
at BunserBuf.process (/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA/node_modules/bser/index.js:292:10)
at /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA/node_modules/bser/index.js:247:12
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
This never happened before the Catalina update. I've had an empty watchman config file in the root of my project since the beginning. On first boot post-update, there was a popup in terminal saying something about permissions but i dont remember exactly. there's also a notice in my terminal in visual studio code saying "the default shell changed to zsh" run chsh -s /bin/zsh to change, so i did.
I've tried:
watchman watch-del-all
watchman server-shutdown
adding full disk access to terminal from within system preferences->privacy tab
npm uninstall watchman & npm uninstall -g watchman
You need to grant disk access to watchman. To do this You need to:
Go to System preferences > Security & Privacy then scroll down
Select Full Disk Access
Unlock it and click + button to add new app/tool
Select Macintosh HD in the folders list
Press this combination shift Command . at the same time to see all the directories list
Click opt > brew > bin (watchman is installed in this folder for MacOS Catalina) || usr > local > Cellar > Watchman > 21***** > bin (watchman is installed in this folder MacOS Monterey)
Look for watchman in the list then select it
Here we go, this should fix the issue.
I had the same issue after updating to Catalina. Wez Furlong's answer worked for me, but I had to provide full disk access to watchman in order to run watchman watch-project command without getting "Operation not permitted" error. As part of prior troubleshooting, I also had provided full disk access to Xcode and Terminal (not sure if this also contributed to the fix).
First run watchman watch-del-all
then run watchman shutdown-server fixed my issue
To change the permissions for Watchman regarding the Documents folder, it's under Security & Privacy -> files & folders in the system preferences
My issue was resolved by checking Watchman in the list under Document folder
The error message indicates a permission problem on /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA.
However, it may be something funky with launchd, so I would suggest:
$ watchman shutdown-server
$ launchctl unload ~/Library/LaunchAgents/com.github.facebook.watchman.plist
$ rm ~/Library/LaunchAgents/com.github.facebook.watchman.plist
$ watchman watch-project /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA
and see if that works or shows more context.
Cross linking back to an issue in our GitHub tracker:
https://github.com/facebook/watchman/issues/751
You need to change something its works for me. follow only following steps:
1. Go to System preferences > Security & Privacy then scroll down.
2. Select Full Disk Access.
3. Look for all watchmen on the list.
4. check(Mark) all Folders in all watchman files.
5. then go to vs code.
6. rebuilt your code.
I hope it will work smoothly
Try to change the directory of your project. I had mine on desktop and was getting that error, moved to the home folder and the error is gone
Just uncheck the repeated boxes in Mac:
System Preferences -> Security and privacy -> Privacy
For me above scenario didn't work, so I tried with different solution which solved the problem for me. (I am using MacBook Pro, chip: Apple M1 pro)
At first you have to update the setting of your Mac OS
System Preference >> security & privacy >> privacy tab >> Full disk access >> click on the lock icon >> checkmark for terminal
Sometime using this steps you are able to resolve the issue, but after this, if you are still facing issue, please use this link: #1030 (comment)
on macos. brew uninstall watchman
it works for me
npx react-native start --port=8088 resolved mine
There is only one solution at the moment. Move your project from the "Desktop" or "Documents" folder to the main folder (~/). None of the other ways worked for me.
This is because MacOS now asks for permissions for these folders (example in the image below). I guess this hasn't been added to the watchman yet.
As a temporary workaround, you can move your project to your home folder and it should run successfully.
To open your home folder, press Command-Shift-H.
(As of June 2022, there seems to be an issue with the 2022.05.30.00 version of Watchman, and this temporary solution is the only way I have been able to get around the issue.)

How to copy intl.so to /usr/lib/php/extensions

I wanted to try Moodle (LMS) on my computer. It requires intl extension.
I used sudo port install php71-intl and successfully installed php71-intl. But it also installed php71 and other dependencies on /opt/local/.
I am using Mac built-in php. Its directories are
/usr/lib/php/extensions/no-debug-non-zts-20160303
/usr/bin/php
I intended to copy the /opt/local/lib/php71/extensions/no-debug-non-zts-20160303/intl.so to /usr/lib/php/extensions/no-debug-non-zts-20160303. But terminal said Operation not permitted.
I tried sudo pecl install intl but failed with make error.
This method sudo port install php71-intl can install the intl.so successfully but in its own direcotry.
So how I can copy the intl.so? Thank you!
You have to disable SIP to do that. First, restart your Mac and before OS starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery. From the Utilities menu, select Terminal and at the prompt type exactly the following and then press Return: csrutil disable
Terminal should display a message that SIP was disabled. From the menu, select Restart. You can re-enable SIP by following the above steps, but using csrutil enable instead.
Find this file "environment.xml" and comment all lines that have "intl" and reload the page. Continue button appears and installation completes without any error. My instance started working like charm, I use it to test out and create courses with SCORM packages, no errors yet.
environment.xml file is located in "admin" folder of moodle directory

VirtualBox install failed in a clean OSX 10.13

I did a clean install of High Sierra, Mac OS X 10.13 on my mac.
I've installed a few apps, some browsers, webStorm, vagrant, skype and slack.
When trying to install virtualBox I get an error message saying:
"The installation failed.
The installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance."
When checking the installers log file I get the following error mesage:
Oct 19 16:22:42 newens-mbp installd[519]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “VirtualBox.pkg”." UserInfo={NSFilePath=./postflight, NSURL=file://localhost/Volumes/VirtualBox/VirtualBox.pkg#VBoxKEXTs.pkg, PKInstallPackageIdentifier=org.virtualbox.pkg.vboxkexts, NSLocalizedDescription=An error occurred while running scripts from the package “VirtualBox.pkg”.} {
NSFilePath = "./postflight";
NSLocalizedDescription = "An error occurred while running scripts from the package \U201cVirtualBox.pkg\U201d.";
NSURL = "file://localhost/Volumes/VirtualBox/VirtualBox.pkg#VBoxKEXTs.pkg";
PKInstallPackageIdentifier = "org.virtualbox.pkg.vboxkexts";
}
I've googled this, and found a few threads here and there that solve different problems. But so far none has worked for me.
Some of the posts I've found:
https://www.virtualbox.org/ticket/15832
Error installing Virtualbox 5.1.10 on macOS Sierra, "The installation failed"
https://apple.stackexchange.com/questions/177868/virtualbox-4-3-26-on-osx-10-10-2-fails-to-install
Can't unload kext while installing VirtualBox 4.3.6
None of these solutions worked for me.
I don't have vmware installed, and have tried searching for the .match_kernel file to delete, but can't find it anywhere. I don't have the option of selecting a partition on disk utilities so can't do a repair disk permissions on it.
I've installed and uninstalled different versions and cold booted in between to try to see if that would help.
Thanks for any help!
after hours of hacking at this issue my coworker and i came to a workable solution. the issue (for me at least) was that when i went to install the package it was getting blocked. you can check to see if this is the case by attempting to install, and when it says 'install failed' go to your security & privacy (in system preferences) and go to the 'general' tab and near the bottom it will say that an oracle application was blocked.
here are the steps we came up with **NOTE: if you tried downloading or installing this a few times like i did you will want to first uninstall virtualbox using the virtualbox uninstall tool which you can find in the downloaded .dmg file. you will also want to eject virtualbox from your devices (in the left panel of finder). after that go ahead and follow these instructions:
Download VirtualBox 5.2 installer
Run the DMG, this creates a device
Attempt to install from .pkg file, it will fail at the validation step
Close installer and run the uninstaller.tool file. DO NOT DELETE THE INSTALLER DEVICE
Go to System Preferences -> Security and Privacy -> General and approve the blocked software from ‘Oracle America’
Run the install from the same .pkg file, it should now complete successfully
I finally managed to solve it with a suggestion from here: https://github.com/caskroom/homebrew-cask/issues/39369#issuecomment-339118861
Run this script:
#!/bin/bash
unload() {
if [ `ps -ef | grep -c VirtualBox$` -ne 0 ]
then
echo "VirtualBox still seems to be running. Please investigate!!"
exit 1;
elif [ `ps -ef | grep -c [V]ir` -gt 0 ]
then
echo "Stopping running processes before unloading Kernel Extensions"
ps -ef | grep [V]ir | awk '{print $2}' | xargs kill
fi
echo "Unloading Kernel Extensions"
kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}
load() {
echo "Loading Kernel Extentions"
sudo kextload "/Library/Application Support/VirtualBox/VBoxDrv.kext" -r "/Library/Application Support/VirtualBox/"
sudo kextload "/Library/Application Support/VirtualBox/VBoxNetAdp.kext" -r "/Library/Application Support/VirtualBox/"
sudo kextload "/Library/Application Support/VirtualBox/VBoxNetFlt.kext" -r "/Library/Application Support/VirtualBox/"
sudo kextload "/Library/Application Support/VirtualBox/VBoxUSB.kext" -r "/Library/Application Support/VirtualBox/"
}
case "$1" in
unload|remove)
unload
;;
load)
load
;;
*|reload)
unload
load
;;
esac
Run this script after you attempt to install virtualbox. Keep approving the kexts until the script runs cleanly:
Run brew cask reinstall --force virtualbox
Kudos to Dan Stroot for the solution.
Solution so far:
Ok, this is a bit of a hassle but we did manage to make it kind of work.
The issue is related to the system not deleting all files from the virtual box installation.
Using the terminal to search for files with virtualbox in the name of the file, we found (non vagrant related) files that were still in the system.
Problem is these files cannot be deleted even using sudo. So we had to reboot the system pressing cmd + r so you go into a troubleshooting system and not the normal OS environment. In there, you can open the terminal and run "csrutil disable", then reboot the system.
This turns off System Integrity Protection for your system so it is NOT RECOMMENDED, but we had to do this in order to delete these files that we couldn't delete before.
So after deleting these files, we ran the install again and now it worked! Immediately afterwards I tried running vagrant and now it worked as expected.
My final problem now: after making sure that vagrant is working, I went back to starting the computer again pressing cmd + r, open the terminal and run "csrutil enable" and reboot.
Back in the normal OS X I try to run vagrant and get an error again. So at the moment I had to go back again, to disable the csrutil, which is NOT RECOMMENDED, but it's as of this moment the only thing that works for me.
I have not tried running all these steps again.
The answer from llene works perfect for me. The key is that, when you already tried to install and not succeed, you have to do exactly this steps:
Run VirtualBox installer
Run install from .pkg file, it will fail at the validation step, it's ok
close installer and run it again, but now choose uninstaller.tool file, inside (DO NOT DELETE THE INSTALLER DEVICE yet)
eject virtualbox from your devices (in the left panel of finder)
After, go to System Preferences -> Security and Privacy -> General and approve the blocked software from ‘Oracle America’, that will appear there
6) Run install again from the same .pkg file. Now it should complete successfully
Managed to solve it.
Eject the VirtualBox image from: Finder > Devices
Remove VirtualBox device
Now allow the exception in: System Preferences > Security & Privacy
Then try to install from the .dmg again so that it remounts the device.
Now its working fine for me.
For those using homebrew, run 'brew install caskroom/cask/virtualbox', which will fail the first time. Then go to System Preferences>Security & Privacy>General as described above, where, at the bottom, there should be a message about the software install being blocked. Click the 'Allow' button next to this message, then go back to your terminal. Run the homebrew command again and this time it will work.
So.. after struggling a lot about this, and after spend a lot of time in stack overflow.. I combined some answers and finnaly get to install virtualbox in my 10.13 osx.
So:
As I read, Sierra has a new security feature that blocks some external programs. During virtualbox installations you can check Preferences > Security & Privacy > General. You will see that Oracle (virtualbox) is being blocked.
So, what I did was:
Run this command at terminal to disable that new sierra gatekeeper: sudo spctl --master-disable
Open the virtualbox install program, and click unistall to make sure there is no trace of the previous installation attempts.
In the desktop, or in the finder left sidebar (in devices) if there is any virtualbox image, you have to eject them.
Delete the previous virtualbox program and download a new one.
Now, if these steps work for you as they worked for me, you will be able to install virtualbox.
(After this you can re-enable the gatekeeper feature running sudo spctl --master-enable
When running the excellent Disk Arbitrator app, Deactivate it — when active it blocks all mounts and optionally remounts them read-only
which, e.g., prevents Spotlight from trashing USB drives but (d-uh)
gotta remember to turn it off when appropriate.

Resources