snedat = Import["/Users/robertcaldwell/Desktop/BRAZIL\ 2012/Materials/sne_m_z.dat"];

zx[i_] := snedat[[i,1]]
mx[i_] := snedat[[i,2]]
dmx[i_] := snedat[[i,3]]

dataplot = ListPlot[Table[{zx[i],mx[i]},{i,1,Length[snedat]}]]

mthy[z_,Ω_,M_] := 5 Log[10,(1+z)NIntegrate[1/Sqrt[Ω (1+x)^3 + (1-Ω)],{x,0,z}]] + M

Length[snedat]

χ[Ω_,M_] := Sum[(mthy[zx[i],Ω,M] - mx[i])^2 / dmx[i]^2,{i,1,Length[snedat]}]

D[χ[0.3,M],M];

Solve[%==0,M]

χ[0.3,43.16740635345649`]

Mmin[Ω_] := -Sum[(mthy[zx[i],Ω,0] - mx[i])/dmx[i]^2,{i,1,Length[snedat]}] / Sum[1/dmx[i]^2,{i,1,Length[snedat]}]

Mmin[0.3]

Mmin[0.4]

χ[0.3, Mmin[0.3]]

Mo = Mmin[0.3]

thyplot = Plot[mthy[z,0.3,Mo],{z,0,1.5},PlotStyle->{Red,Thick}]

Show[dataplot,thyplot]

Table[{Ω,  Mo = Mmin[Ω];χ[Ω,Mo]},{Ω,0.2,0.4,0.01}]

q={{0.2`,580.4988540379353`},{0.21000000000000002`,575.8292884383491`},{0.22`,571.9186128600593`},{0.23`,568.7247859812672`},{0.24000000000000002`,566.2089256269827`},{0.25`,564.3349960596869`},{0.26`,563.0695339043023`},{0.27`,562.3814069973465`},{0.28`,562.2416014283442`},{0.29000000000000004`,562.6230328301592`},{0.30000000000000004`,563.5003786145452`},{0.31`,564.8499283715009`},{0.32`,566.6494500795127`},{0.33`,568.8780701276205`},{0.34`,571.5161654435643`},{0.35`,574.5452662669076`},{0.36`,577.9479683107871`},{0.37`,581.7078532281012`},{0.38`,585.8094164433961`},{0.39`,590.2380015349493`},{0.4`,594.9797404563991`}};

ListPlot[q,Joined->True,PlotStyle->{Red,Thick}]

minimum is at 
Ω= 0.28

χ[0.28, Mmin[0.28]]

Mo = Mmin[0.28]

thyplot = Plot[mthy[z,0.28,Mo],{z,0,1.5},PlotStyle->{Red,Thick}]

Show[dataplot,thyplot]