Tag Archives: mac

MySQL CSV import skipping rows

I was experiencing problems with loading CSV files into MySQL tables. I noticed that it was skipping every other row in most cases. I was using the following SQL code to load the CSV file:

LOAD DATA LOCAL INFILE 'test.csv'
INTO TABLE games
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 0 LINES;

Solution:
It turns out that the CSV file that I was loading had line endings that my MySQL client did not recognize. I found out that the CSV file was coming from a Windows machine while I was trying to load it onto a Mac OSX machine’s MySQL client/server.

To fix this, I ran the following conversion command, which removed the Windows specific line endings:

1
cat test.csv | tr -d '\r' > "test.fixed.csv"

I verified that this fixed the file by opening it up in TextWrangler and noting the line ending style on the bottom status bar.

mDNSResponder and discoveryd hanging in Yosemite: CPU spikes at 100%

Since updating to Yosemite, I have been seeing 100% CPU spikes. You will see message (like the ones pasted below) from the Console.app. For some reason, discoveryd and mDNSResponder start going wild. Most of the instructions found online tell us to restart /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist using launchctl. However in Yosemite, there is no com.apple.mDNSResponder.plist.

Solution
You must restart discoveryd like the following:

1
2
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

Console error messages

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:70 Err:-1 Errno:61 Connection refused
1/23/15 2:20:59.358 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:20:59.477 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:26 Err:-1 Errno:61 Connection refused
1/23/15 2:20:59.478 PM Slack[16482]: tcp_connection_host_start 1929 DNSServiceCreateConnection failed: -65563
1/23/15 2:20:59.508 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:20:59.609 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:20:59.679 PM Google Chrome[15689]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:20:59.755 PM awacsd[265]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:20:59.774 PM coreaudiod[444]: 2015-01-23 02:20:59.774313 PM [BonjourBrowser] Retrying Bonjour start for _raop._tcp. after failure
1/23/15 2:20:59.775 PM coreaudiod[444]: 2015-01-23 02:20:59.774751 PM [BonjourBrowser] Retrying Bonjour start for _airplay._tcp. after failure
1/23/15 2:20:59.775 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:20:59.775 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:00.015 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:15 Err:-1 Errno:61 Connection refused
1/23/15 2:21:00.015 PM Slack[16482]: tcp_connection_host_start 1930 DNSServiceCreateConnection failed: -65563
1/23/15 2:21:00.300 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:00.360 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:00.513 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:00.614 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:00.666 PM sharingd[460]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:00.685 PM Google Chrome[15689]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:00.829 PM awacsd[265]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:00.841 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:00.841 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:01.117 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:01.177 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:01.301 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:01.365 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:34 Err:-1 Errno:61 Connection refused
1/23/15 2:21:01.366 PM Slack[16482]: tcp_connection_host_start 1932 DNSServiceCreateConnection failed: -65563
1/23/15 2:21:01.366 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:01.469 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:01.519 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:01.615 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:27 Err:-1 Errno:61 Connection refused
1/23/15 2:21:01.615 PM Slack[16482]: tcp_connection_host_start 1931 DNSServiceCreateConnection failed: -65563
1/23/15 2:21:01.670 PM sharingd[460]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:01.686 PM Google Chrome[15689]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:54 Err:-1 Errno:61 Connection refused
1/23/15 2:21:01.687 PM Google Chrome[15689]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:01.883 PM awacsd[265]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:11 Err:-1 Errno:61 Connection refused
1/23/15 2:21:01.883 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:01.883 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:01.883 PM awacsd[265]: RRMetaClientItem: DNSServiceQueryRecord: -65563
1/23/15 2:21:01.884 PM awacsd[265]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:02.122 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:02.180 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:02.307 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:30 Err:-1 Errno:61 Connection refused
1/23/15 2:21:02.307 PM Slack[16482]: tcp_connection_host_start 1933 DNSServiceCreateConnection failed: -65563
1/23/15 2:21:02.308 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:02.369 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:02.475 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:02.522 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:26 Err:-1 Errno:61 Connection refused
1/23/15 2:21:02.522 PM Slack[16482]: tcp_connection_host_start 1934 DNSServiceCreateConnection failed: -65563
1/23/15 2:21:02.522 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
1/23/15 2:21:02.674 PM sharingd[460]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:02.691 PM Google Chrome[15689]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:02.938 PM awacsd[265]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:02.938 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:5 Err:-1 Errno:61 Connection refused
1/23/15 2:21:02.938 PM coreaudiod[444]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:6 Err:-1 Errno:61 Connection refused
1/23/15 2:21:02.938 PM coreaudiod[444]: 2015-01-23 02:21:02.938188 PM [BonjourBrowser] ### Start browse for _raop._tcp. on if <any>, flags 0x7000000000100000 failed: -65563/0xFFFEFFE5 kDNSServiceErr_ServiceNotRunning
1/23/15 2:21:02.939 PM coreaudiod[444]: 2015-01-23 02:21:02.938754 PM [BonjourBrowser] ### Start browse for _airplay._tcp. on if <any>, flags 0x7000000000100000 failed: -65563/0xFFFEFFE5 kDNSServiceErr_ServiceNotRunning
1/23/15 2:21:02.939 PM coreaudiod[444]: 2015-01-23 02:21:02.939078 PM [BonjourBrowser] ### Browse for _raop._tcp. failed, retrying in 7349 ms: -65563/0xFFFEFFE5 kDNSServiceErr_ServiceNotRunning
1/23/15 2:21:02.939 PM coreaudiod[444]: 2015-01-23 02:21:02.939416 PM [BonjourBrowser] ### Browse for _airplay._tcp. failed, retrying in 7349 ms: -65563/0xFFFEFFE5 kDNSServiceErr_ServiceNotRunning
1/23/15 2:21:03.128 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:03.186 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:03.313 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
1/23/15 2:21:03.374 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:03.478 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
1/23/15 2:21:03.523 PM Slack[16482]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 2

EXT4 repair on Mac OSX

My NAS WD drive recently became corrupt. It had trouble saving large files and running them. My router constantly complained about not being able to properly run Samba/swap on it.

Not having a Linux OS handy, I had a tall task to repair an EXT4 filesystem on Mac OSX 10.10.

I first tried the open source solutions: fuse-ext2, osxfuse, and ext2fuse (read-only). While these tools work great in allowing access to ext4. They do not include any disk repair tools. e2fsprogs from Homebrew also does not include the fsck utilities.

I also tried using the commercial ExtFS by Paragon. It integrates directly with Disk Utility and is able to verify/check the disk for errors. While it reported the errors properly, it had trouble repairing the filesystem and reported my ext4 partition as ext3. It failed to repair reporting: “Error: Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.” Also, ExtFS was very buggy as in it consistently froze the System Preferences and Finder (while ejecting and mounting).

Finally, I installed VirtualBox with an Ubuntu VM and added the USB drive from settings. I had to umount the drive from inside Ubuntu and running fsck -y was a breeze. Now ExtFS by Paragon also reports that the Disk is good.

Hackintosh doesn’t connect via ethernet

Does your Mac Ethernet/Wireless keep giving you a fake 169.254.x.x ip address?

Recently I started running Mac OS X Leopard (10.5.8) on my spare computer. It worked fine for a few days until one day when I changed my router, my Mac stopped connecting to the router. It would repeatedly get a 169.254.x.x ip address through DHCP. If I set the IP address manually, it would show that it assigned the IP address, yet it would still not “properly” be connected in the background.

So here is what I did to fix this problem. Open up Terminal using Spotlight. And type the command:

sudo ifconfig en0 ether 00:11:22:33:44:55

It will then ask you for your password. That’s it.

Explanation:

sudo: Gives you administrative power

ifconfig: the program that interacts with all your connectivity configurations

en0: the interface’s name, it could also be en1, en2, etc. (depending on the amount of network wired/wireless cards you have)

00:11:22:33:44:55: the mac address, pick whatever hex combination (i.e. only use characters 0-9 and a-z)

Please share your experiences.