Reputation: 171
I run El Capitan OS X
and am trying to use /dev/null
however when I do anything with it, for example ls
:
ls -l /dev/null
ls: /dev/null: No such file or directory
I've also tried:
sudo mknod -m 666 /dev/null c 1 3
However that outputs the following:
mknod: illegal option -- m
usage: mknod [-F format] name [b | c] major minor
mknod [-F format] name [b | c] major unit subunit
mknod name [b | c] number
mknod name w
How can I fix this?
Upvotes: 2
Views: 7526
Reputation: 66
А similar problem occurs with chroot
usage, f.e.
#!/bin/bash
mkdir ./newroot
cp -R /bin /lib /lib64 /usr /etc ./newroot
chroot ./newroot
There is no /dev/null
in the new enviroment, which leads to errors. One way to fix it is creating /dev/
directory, so piping to /dev/null
is just writing to the ordinary text file /dev/null
.
Upvotes: 0
Reputation: 171
I was able to use the answer provided from this question along with the question itself. The fix for this issue is as follows:
sudo -s << _EOF
mknod /dev/null c 3 2
chmod 666 /dev/null
_EOF
Upvotes: 1